package gui;

import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TableView;
import javafx.scene.control.TabPane;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.stage.Modality;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableColumn.CellDataFeatures;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.control.TitledPane;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.scene.control.Tooltip;

import javafx.scene.layout.GridPane;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.stage.FileChooser;
import javafx.stage.FileChooser.ExtensionFilter;
import javafx.stage.Stage;
import java.io.File;
import javafx.scene.control.cell.PropertyValueFactory;
import java.util.List;
import java.time.LocalDate;
import java.util.LinkedList;

import java.lang.reflect.Array;
import java.net.URL;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.ResourceBundle;

import gui.supportclass.*;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.beans.property.ReadOnlyStringWrapper;
import javafx.beans.value.ObservableValue;
import javafx.util.Callback;
import services.*;
import services.impl.*;
import java.time.format.DateTimeFormatter;
import java.lang.reflect.Method;

import entities.*;

public class PrototypeController implements Initializable {


	DateTimeFormatter dateformatter;
	 
	@Override
	public void initialize(URL location, ResourceBundle resources) {
	
		labmanagesystem_service = ServiceManager.createLabManageSystem();
		thirdpartyservices_service = ServiceManager.createThirdPartyServices();
		createteamservice_service = ServiceManager.createCreateTeamService();
		jointeamservice_service = ServiceManager.createJoinTeamService();
		createplanservice_service = ServiceManager.createCreatePlanService();
		createdailyservice_service = ServiceManager.createCreateDailyService();
		checkplanservice_service = ServiceManager.createCheckPlanService();
		managedailyservice_service = ServiceManager.createManageDailyService();
		manageaccountservice_service = ServiceManager.createManageAccountService();
				
		this.dateformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
		
	   	 //prepare data for contract
	   	 prepareData();
	   	 
	   	 //generate invariant panel
	   	 genereateInvairantPanel();
	   	 
		 //Actor Threeview Binding
		 actorTreeViewBinding();
		 
		 //Generate
		 generatOperationPane();
		 genereateOpInvariantPanel();
		 
		 //prilimariry data
		 try {
			DataFitService.fit();
		 } catch (PreconditionException e) {
			// TODO Auto-generated catch block
		 	e.printStackTrace();
		 }
		 
		 //generate class statistic
		 classStatisicBingding();
		 
		 //generate object statistic
		 generateObjectTable();
		 
		 //genereate association statistic
		 associationStatisicBingding();

		 //set listener 
		 setListeners();
	}
	
	/**
	 * deepCopyforTreeItem (Actor Generation)
	 */
	TreeItem<String> deepCopyTree(TreeItem<String> item) {
		    TreeItem<String> copy = new TreeItem<String>(item.getValue());
		    for (TreeItem<String> child : item.getChildren()) {
		        copy.getChildren().add(deepCopyTree(child));
		    }
		    return copy;
	}
	
	/**
	 * check all invariant and update invariant panel
	 */
	public void invairantPanelUpdate() {
		
		try {
			
			for (Entry<String, Label> inv : entity_invariants_label_map.entrySet()) {
				String invname = inv.getKey();
				String[] invt = invname.split("_");
				String entityName = invt[0];
				for (Object o : EntityManager.getAllInstancesOf(entityName)) {				
					 Method m = o.getClass().getMethod(invname);
					 if ((boolean)m.invoke(o) == false) {
						 inv.getValue().setStyle("-fx-max-width: Infinity;" + 
									"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #af0c27 100%);" +
								    "-fx-padding: 6px;" +
								    "-fx-border-color: black;");
						 break;
					 }
				}				
			}
			
			for (Entry<String, Label> inv : service_invariants_label_map.entrySet()) {
				String invname = inv.getKey();
				String[] invt = invname.split("_");
				String serviceName = invt[0];
				for (Object o : ServiceManager.getAllInstancesOf(serviceName)) {				
					 Method m = o.getClass().getMethod(invname);
					 if ((boolean)m.invoke(o) == false) {
						 inv.getValue().setStyle("-fx-max-width: Infinity;" + 
									"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #af0c27 100%);" +
								    "-fx-padding: 6px;" +
								    "-fx-border-color: black;");
						 break;
					 }
				}
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}	

	/**
	 * check op invariant and update op invariant panel
	 */		
	public void opInvairantPanelUpdate() {
		
		try {
			
			for (Entry<String, Label> inv : op_entity_invariants_label_map.entrySet()) {
				String invname = inv.getKey();
				String[] invt = invname.split("_");
				String entityName = invt[0];
				for (Object o : EntityManager.getAllInstancesOf(entityName)) {
					 Method m = o.getClass().getMethod(invname);
					 if ((boolean)m.invoke(o) == false) {
						 inv.getValue().setStyle("-fx-max-width: Infinity;" + 
									"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #af0c27 100%);" +
								    "-fx-padding: 6px;" +
								    "-fx-border-color: black;");
						 break;
					 }
				}
			}
			
			for (Entry<String, Label> inv : op_service_invariants_label_map.entrySet()) {
				String invname = inv.getKey();
				String[] invt = invname.split("_");
				String serviceName = invt[0];
				for (Object o : ServiceManager.getAllInstancesOf(serviceName)) {
					 Method m = o.getClass().getMethod(invname);
					 if ((boolean)m.invoke(o) == false) {
						 inv.getValue().setStyle("-fx-max-width: Infinity;" + 
									"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #af0c27 100%);" +
								    "-fx-padding: 6px;" +
								    "-fx-border-color: black;");
						 break;
					 }
				}
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/* 
	*	generate op invariant panel 
	*/
	public void genereateOpInvariantPanel() {
		
		opInvariantPanel = new HashMap<String, VBox>();
		op_entity_invariants_label_map = new LinkedHashMap<String, Label>();
		op_service_invariants_label_map = new LinkedHashMap<String, Label>();
		
		VBox v;
		List<String> entities;
		v = new VBox();
		
		//entities invariants
		entities = ManageAccountServiceImpl.opINVRelatedEntity.get("createAccount");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("createAccount" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("ManageAccountService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("createAccount", v);
		
		v = new VBox();
		
		//entities invariants
		entities = CreateTeamServiceImpl.opINVRelatedEntity.get("createTeam");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("createTeam" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("CreateTeamService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("createTeam", v);
		
		v = new VBox();
		
		//entities invariants
		entities = CreateTeamServiceImpl.opINVRelatedEntity.get("createGroup");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("createGroup" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("CreateTeamService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("createGroup", v);
		
		v = new VBox();
		
		//entities invariants
		entities = CreateTeamServiceImpl.opINVRelatedEntity.get("handleTeamApply");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("handleTeamApply" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("CreateTeamService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("handleTeamApply", v);
		
		v = new VBox();
		
		//entities invariants
		entities = CreateTeamServiceImpl.opINVRelatedEntity.get("handleGroupApply");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("handleGroupApply" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("CreateTeamService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("handleGroupApply", v);
		
		v = new VBox();
		
		//entities invariants
		entities = CreateTeamServiceImpl.opINVRelatedEntity.get("dismissGroup");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("dismissGroup" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("CreateTeamService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("dismissGroup", v);
		
		v = new VBox();
		
		//entities invariants
		entities = CreateTeamServiceImpl.opINVRelatedEntity.get("dismissTeam");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("dismissTeam" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("CreateTeamService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("dismissTeam", v);
		
		v = new VBox();
		
		//entities invariants
		entities = JoinTeamServiceImpl.opINVRelatedEntity.get("applyJoinTeam");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("applyJoinTeam" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("JoinTeamService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("applyJoinTeam", v);
		
		v = new VBox();
		
		//entities invariants
		entities = JoinTeamServiceImpl.opINVRelatedEntity.get("applyJoinGroup");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("applyJoinGroup" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("JoinTeamService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("applyJoinGroup", v);
		
		v = new VBox();
		
		//entities invariants
		entities = JoinTeamServiceImpl.opINVRelatedEntity.get("exitGroup");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("exitGroup" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("JoinTeamService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("exitGroup", v);
		
		v = new VBox();
		
		//entities invariants
		entities = JoinTeamServiceImpl.opINVRelatedEntity.get("exitTeam");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("exitTeam" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("JoinTeamService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("exitTeam", v);
		
		v = new VBox();
		
		//entities invariants
		entities = CreatePlanServiceImpl.opINVRelatedEntity.get("createPlan");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("createPlan" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("CreatePlanService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("createPlan", v);
		
		v = new VBox();
		
		//entities invariants
		entities = CreatePlanServiceImpl.opINVRelatedEntity.get("editPlan");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("editPlan" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("CreatePlanService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("editPlan", v);
		
		v = new VBox();
		
		//entities invariants
		entities = CreatePlanServiceImpl.opINVRelatedEntity.get("finishPlan");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("finishPlan" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("CreatePlanService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("finishPlan", v);
		
		v = new VBox();
		
		//entities invariants
		entities = CreateDailyServiceImpl.opINVRelatedEntity.get("createDaily");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("createDaily" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("CreateDailyService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("createDaily", v);
		
		v = new VBox();
		
		//entities invariants
		entities = CreateDailyServiceImpl.opINVRelatedEntity.get("editDaily");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("editDaily" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("CreateDailyService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("editDaily", v);
		
		v = new VBox();
		
		//entities invariants
		entities = CreateDailyServiceImpl.opINVRelatedEntity.get("finishDaily");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("finishDaily" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("CreateDailyService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("finishDaily", v);
		
		v = new VBox();
		
		//entities invariants
		entities = ManageDailyServiceImpl.opINVRelatedEntity.get("deleteDaily");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("deleteDaily" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("ManageDailyService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("deleteDaily", v);
		
		v = new VBox();
		
		//entities invariants
		entities = ManageDailyServiceImpl.opINVRelatedEntity.get("operateDaily");
		if (entities != null) {
			for (String opRelatedEntities : entities) {
				for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
					
					String invname = inv.getKey();
					String[] invt = invname.split("_");
					String entityName = invt[0];
		
					if (opRelatedEntities.equals(entityName)) {
						Label l = new Label(invname);
						l.setStyle("-fx-max-width: Infinity;" + 
								"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
							    "-fx-padding: 6px;" +
							    "-fx-border-color: black;");
						Tooltip tp = new Tooltip();
						tp.setText(inv.getValue());
						l.setTooltip(tp);
						
						op_entity_invariants_label_map.put(invname, l);
						
						v.getChildren().add(l);
					}
				}
			}
		} else {
			Label l = new Label("operateDaily" + " is no related invariants");
			l.setPadding(new Insets(8, 8, 8, 8));
			v.getChildren().add(l);
		}
		
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			String invname = inv.getKey();
			String[] invt = invname.split("_");
			String serviceName = invt[0];
			
			if (serviceName.equals("ManageDailyService")) {
				Label l = new Label(invname);
				l.setStyle("-fx-max-width: Infinity;" + 
						   "-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
						   "-fx-padding: 6px;" +
						   "-fx-border-color: black;");
				Tooltip tp = new Tooltip();
				tp.setText(inv.getValue());
				l.setTooltip(tp);
				
				op_entity_invariants_label_map.put(invname, l);
				
				v.getChildren().add(l);
			}
		}
		opInvariantPanel.put("operateDaily", v);
		
		
	}
	
	
	/*
	*  generate invariant panel
	*/
	public void genereateInvairantPanel() {
		
		service_invariants_label_map = new LinkedHashMap<String, Label>();
		entity_invariants_label_map = new LinkedHashMap<String, Label>();
		
		//entity_invariants_map
		VBox v = new VBox();
		//service invariants
		for (Entry<String, String> inv : service_invariants_map.entrySet()) {
			
			Label l = new Label(inv.getKey());
			l.setStyle("-fx-max-width: Infinity;" + 
					"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
				    "-fx-padding: 6px;" +
				    "-fx-border-color: black;");
			
			Tooltip tp = new Tooltip();
			tp.setText(inv.getValue());
			l.setTooltip(tp);
			
			service_invariants_label_map.put(inv.getKey(), l);
			v.getChildren().add(l);
			
		}
		//entity invariants
		for (Entry<String, String> inv : entity_invariants_map.entrySet()) {
			
			String INVname = inv.getKey();
			Label l = new Label(INVname);
			if (INVname.contains("AssociationInvariants")) {
				l.setStyle("-fx-max-width: Infinity;" + 
					"-fx-background-color: linear-gradient(to right, #099b17 0%, #F0FFFF 100%);" +
				    "-fx-padding: 6px;" +
				    "-fx-border-color: black;");
			} else {
				l.setStyle("-fx-max-width: Infinity;" + 
									"-fx-background-color: linear-gradient(to right, #7FFF00 0%, #F0FFFF 100%);" +
								    "-fx-padding: 6px;" +
								    "-fx-border-color: black;");
			}	
			Tooltip tp = new Tooltip();
			tp.setText(inv.getValue());
			l.setTooltip(tp);
			
			entity_invariants_label_map.put(inv.getKey(), l);
			v.getChildren().add(l);
			
		}
		ScrollPane scrollPane = new ScrollPane(v);
		scrollPane.setFitToWidth(true);
		all_invariant_pane.setMaxHeight(850);
		
		all_invariant_pane.setContent(scrollPane);
	}	
	
	
	
	/* 
	*	mainPane add listener
	*/
	public void setListeners() {
		 mainPane.getSelectionModel().selectedItemProperty().addListener((ov, oldTab, newTab) -> {
			 
			 	if (newTab.getText().equals("System State")) {
			 		System.out.println("refresh all");
			 		refreshAll();
			 	}
		    
		    });
	}
	
	
	//checking all invariants
	public void checkAllInvariants() {
		
		invairantPanelUpdate();
	
	}	
	
	//refresh all
	public void refreshAll() {
		
		invairantPanelUpdate();
		classStatisticUpdate();
		generateObjectTable();
	}
	
	
	//update association
	public void updateAssociation(String className) {
		
		for (AssociationInfo assoc : allassociationData.get(className)) {
			assoc.computeAssociationNumber();
		}
		
	}
	
	public void updateAssociation(String className, int index) {
		
		for (AssociationInfo assoc : allassociationData.get(className)) {
			assoc.computeAssociationNumber(index);
		}
		
	}	
	
	public void generateObjectTable() {
		
		allObjectTables = new LinkedHashMap<String, TableView>();
		
		TableView<Map<String, String>> tableUser = new TableView<Map<String, String>>();

		//super entity attribute column
						
		//attributes table column
		TableColumn<Map<String, String>, String> tableUser_Id = new TableColumn<Map<String, String>, String>("Id");
		tableUser_Id.setMinWidth("Id".length()*10);
		tableUser_Id.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Id"));
		    }
		});	
		tableUser.getColumns().add(tableUser_Id);
		TableColumn<Map<String, String>, String> tableUser_Username = new TableColumn<Map<String, String>, String>("Username");
		tableUser_Username.setMinWidth("Username".length()*10);
		tableUser_Username.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Username"));
		    }
		});	
		tableUser.getColumns().add(tableUser_Username);
		TableColumn<Map<String, String>, String> tableUser_Password = new TableColumn<Map<String, String>, String>("Password");
		tableUser_Password.setMinWidth("Password".length()*10);
		tableUser_Password.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Password"));
		    }
		});	
		tableUser.getColumns().add(tableUser_Password);
		TableColumn<Map<String, String>, String> tableUser_Identity = new TableColumn<Map<String, String>, String>("Identity");
		tableUser_Identity.setMinWidth("Identity".length()*10);
		tableUser_Identity.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Identity"));
		    }
		});	
		tableUser.getColumns().add(tableUser_Identity);
		
		//table data
		ObservableList<Map<String, String>> dataUser = FXCollections.observableArrayList();
		List<User> rsUser = EntityManager.getAllInstancesOf("User");
		for (User r : rsUser) {
			//table entry
			Map<String, String> unit = new HashMap<String, String>();
			
			if (r.getId() != null)
				unit.put("Id", String.valueOf(r.getId()));
			else
				unit.put("Id", "");
			if (r.getUsername() != null)
				unit.put("Username", String.valueOf(r.getUsername()));
			else
				unit.put("Username", "");
			if (r.getPassword() != null)
				unit.put("Password", String.valueOf(r.getPassword()));
			else
				unit.put("Password", "");
			unit.put("Identity", String.valueOf(r.getIdentity()));

			dataUser.add(unit);
		}
		
		tableUser.getSelectionModel().selectedIndexProperty().addListener(
							 (observable, oldValue, newValue) ->  { 
							 										 //get selected index
							 										 objectindex = tableUser.getSelectionModel().getSelectedIndex();
							 			 				 			 System.out.println("select: " + objectindex);

							 			 				 			 //update association object information
							 			 				 			 if (objectindex != -1)
										 			 					 updateAssociation("User", objectindex);
							 			 				 			 
							 			 				 		  });
		
		tableUser.setItems(dataUser);
		allObjectTables.put("User", tableUser);
		
		TableView<Map<String, String>> tableStudent = new TableView<Map<String, String>>();

		//super entity attribute column
		TableColumn<Map<String, String>, String> tableStudent_Id = new TableColumn<Map<String, String>, String>("Id");
		tableStudent_Id.setMinWidth("Id".length()*10);
		tableStudent_Id.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Id"));
		    }
		});	
		tableStudent.getColumns().add(tableStudent_Id);
		TableColumn<Map<String, String>, String> tableStudent_Username = new TableColumn<Map<String, String>, String>("Username");
		tableStudent_Username.setMinWidth("Username".length()*10);
		tableStudent_Username.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Username"));
		    }
		});	
		tableStudent.getColumns().add(tableStudent_Username);
		TableColumn<Map<String, String>, String> tableStudent_Password = new TableColumn<Map<String, String>, String>("Password");
		tableStudent_Password.setMinWidth("Password".length()*10);
		tableStudent_Password.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Password"));
		    }
		});	
		tableStudent.getColumns().add(tableStudent_Password);
		TableColumn<Map<String, String>, String> tableStudent_Identity = new TableColumn<Map<String, String>, String>("Identity");
		tableStudent_Identity.setMinWidth("Identity".length()*10);
		tableStudent_Identity.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Identity"));
		    }
		});	
		tableStudent.getColumns().add(tableStudent_Identity);
						
		//attributes table column
		TableColumn<Map<String, String>, String> tableStudent_ClassName = new TableColumn<Map<String, String>, String>("ClassName");
		tableStudent_ClassName.setMinWidth("ClassName".length()*10);
		tableStudent_ClassName.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("ClassName"));
		    }
		});	
		tableStudent.getColumns().add(tableStudent_ClassName);
		
		//table data
		ObservableList<Map<String, String>> dataStudent = FXCollections.observableArrayList();
		List<Student> rsStudent = EntityManager.getAllInstancesOf("Student");
		for (Student r : rsStudent) {
			//table entry
			Map<String, String> unit = new HashMap<String, String>();
			if (r.getId() != null)
				unit.put("Id", String.valueOf(r.getId()));
			else
				unit.put("Id", "");
			if (r.getUsername() != null)
				unit.put("Username", String.valueOf(r.getUsername()));
			else
				unit.put("Username", "");
			if (r.getPassword() != null)
				unit.put("Password", String.valueOf(r.getPassword()));
			else
				unit.put("Password", "");
			unit.put("Identity", String.valueOf(r.getIdentity()));
			
			if (r.getClassName() != null)
				unit.put("ClassName", String.valueOf(r.getClassName()));
			else
				unit.put("ClassName", "");

			dataStudent.add(unit);
		}
		
		tableStudent.getSelectionModel().selectedIndexProperty().addListener(
							 (observable, oldValue, newValue) ->  { 
							 										 //get selected index
							 										 objectindex = tableStudent.getSelectionModel().getSelectedIndex();
							 			 				 			 System.out.println("select: " + objectindex);

							 			 				 			 //update association object information
							 			 				 			 if (objectindex != -1)
										 			 					 updateAssociation("Student", objectindex);
							 			 				 			 
							 			 				 		  });
		
		tableStudent.setItems(dataStudent);
		allObjectTables.put("Student", tableStudent);
		
		TableView<Map<String, String>> tableTeacher = new TableView<Map<String, String>>();

		//super entity attribute column
		TableColumn<Map<String, String>, String> tableTeacher_Id = new TableColumn<Map<String, String>, String>("Id");
		tableTeacher_Id.setMinWidth("Id".length()*10);
		tableTeacher_Id.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Id"));
		    }
		});	
		tableTeacher.getColumns().add(tableTeacher_Id);
		TableColumn<Map<String, String>, String> tableTeacher_Username = new TableColumn<Map<String, String>, String>("Username");
		tableTeacher_Username.setMinWidth("Username".length()*10);
		tableTeacher_Username.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Username"));
		    }
		});	
		tableTeacher.getColumns().add(tableTeacher_Username);
		TableColumn<Map<String, String>, String> tableTeacher_Password = new TableColumn<Map<String, String>, String>("Password");
		tableTeacher_Password.setMinWidth("Password".length()*10);
		tableTeacher_Password.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Password"));
		    }
		});	
		tableTeacher.getColumns().add(tableTeacher_Password);
		TableColumn<Map<String, String>, String> tableTeacher_Identity = new TableColumn<Map<String, String>, String>("Identity");
		tableTeacher_Identity.setMinWidth("Identity".length()*10);
		tableTeacher_Identity.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Identity"));
		    }
		});	
		tableTeacher.getColumns().add(tableTeacher_Identity);
						
		//attributes table column
		TableColumn<Map<String, String>, String> tableTeacher_Introduce = new TableColumn<Map<String, String>, String>("Introduce");
		tableTeacher_Introduce.setMinWidth("Introduce".length()*10);
		tableTeacher_Introduce.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Introduce"));
		    }
		});	
		tableTeacher.getColumns().add(tableTeacher_Introduce);
		
		//table data
		ObservableList<Map<String, String>> dataTeacher = FXCollections.observableArrayList();
		List<Teacher> rsTeacher = EntityManager.getAllInstancesOf("Teacher");
		for (Teacher r : rsTeacher) {
			//table entry
			Map<String, String> unit = new HashMap<String, String>();
			if (r.getId() != null)
				unit.put("Id", String.valueOf(r.getId()));
			else
				unit.put("Id", "");
			if (r.getUsername() != null)
				unit.put("Username", String.valueOf(r.getUsername()));
			else
				unit.put("Username", "");
			if (r.getPassword() != null)
				unit.put("Password", String.valueOf(r.getPassword()));
			else
				unit.put("Password", "");
			unit.put("Identity", String.valueOf(r.getIdentity()));
			
			if (r.getIntroduce() != null)
				unit.put("Introduce", String.valueOf(r.getIntroduce()));
			else
				unit.put("Introduce", "");

			dataTeacher.add(unit);
		}
		
		tableTeacher.getSelectionModel().selectedIndexProperty().addListener(
							 (observable, oldValue, newValue) ->  { 
							 										 //get selected index
							 										 objectindex = tableTeacher.getSelectionModel().getSelectedIndex();
							 			 				 			 System.out.println("select: " + objectindex);

							 			 				 			 //update association object information
							 			 				 			 if (objectindex != -1)
										 			 					 updateAssociation("Teacher", objectindex);
							 			 				 			 
							 			 				 		  });
		
		tableTeacher.setItems(dataTeacher);
		allObjectTables.put("Teacher", tableTeacher);
		
		TableView<Map<String, String>> tableManager = new TableView<Map<String, String>>();

		//super entity attribute column
		TableColumn<Map<String, String>, String> tableManager_Id = new TableColumn<Map<String, String>, String>("Id");
		tableManager_Id.setMinWidth("Id".length()*10);
		tableManager_Id.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Id"));
		    }
		});	
		tableManager.getColumns().add(tableManager_Id);
		TableColumn<Map<String, String>, String> tableManager_Username = new TableColumn<Map<String, String>, String>("Username");
		tableManager_Username.setMinWidth("Username".length()*10);
		tableManager_Username.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Username"));
		    }
		});	
		tableManager.getColumns().add(tableManager_Username);
		TableColumn<Map<String, String>, String> tableManager_Password = new TableColumn<Map<String, String>, String>("Password");
		tableManager_Password.setMinWidth("Password".length()*10);
		tableManager_Password.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Password"));
		    }
		});	
		tableManager.getColumns().add(tableManager_Password);
		TableColumn<Map<String, String>, String> tableManager_Identity = new TableColumn<Map<String, String>, String>("Identity");
		tableManager_Identity.setMinWidth("Identity".length()*10);
		tableManager_Identity.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Identity"));
		    }
		});	
		tableManager.getColumns().add(tableManager_Identity);
						
		//attributes table column
		TableColumn<Map<String, String>, String> tableManager_Department = new TableColumn<Map<String, String>, String>("Department");
		tableManager_Department.setMinWidth("Department".length()*10);
		tableManager_Department.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Department"));
		    }
		});	
		tableManager.getColumns().add(tableManager_Department);
		
		//table data
		ObservableList<Map<String, String>> dataManager = FXCollections.observableArrayList();
		List<Manager> rsManager = EntityManager.getAllInstancesOf("Manager");
		for (Manager r : rsManager) {
			//table entry
			Map<String, String> unit = new HashMap<String, String>();
			if (r.getId() != null)
				unit.put("Id", String.valueOf(r.getId()));
			else
				unit.put("Id", "");
			if (r.getUsername() != null)
				unit.put("Username", String.valueOf(r.getUsername()));
			else
				unit.put("Username", "");
			if (r.getPassword() != null)
				unit.put("Password", String.valueOf(r.getPassword()));
			else
				unit.put("Password", "");
			unit.put("Identity", String.valueOf(r.getIdentity()));
			
			if (r.getDepartment() != null)
				unit.put("Department", String.valueOf(r.getDepartment()));
			else
				unit.put("Department", "");

			dataManager.add(unit);
		}
		
		tableManager.getSelectionModel().selectedIndexProperty().addListener(
							 (observable, oldValue, newValue) ->  { 
							 										 //get selected index
							 										 objectindex = tableManager.getSelectionModel().getSelectedIndex();
							 			 				 			 System.out.println("select: " + objectindex);

							 			 				 			 //update association object information
							 			 				 			 if (objectindex != -1)
										 			 					 updateAssociation("Manager", objectindex);
							 			 				 			 
							 			 				 		  });
		
		tableManager.setItems(dataManager);
		allObjectTables.put("Manager", tableManager);
		
		TableView<Map<String, String>> tableTeam = new TableView<Map<String, String>>();

		//super entity attribute column
						
		//attributes table column
		TableColumn<Map<String, String>, String> tableTeam_Id = new TableColumn<Map<String, String>, String>("Id");
		tableTeam_Id.setMinWidth("Id".length()*10);
		tableTeam_Id.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Id"));
		    }
		});	
		tableTeam.getColumns().add(tableTeam_Id);
		TableColumn<Map<String, String>, String> tableTeam_Name = new TableColumn<Map<String, String>, String>("Name");
		tableTeam_Name.setMinWidth("Name".length()*10);
		tableTeam_Name.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Name"));
		    }
		});	
		tableTeam.getColumns().add(tableTeam_Name);
		TableColumn<Map<String, String>, String> tableTeam_Introduce = new TableColumn<Map<String, String>, String>("Introduce");
		tableTeam_Introduce.setMinWidth("Introduce".length()*10);
		tableTeam_Introduce.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Introduce"));
		    }
		});	
		tableTeam.getColumns().add(tableTeam_Introduce);
		TableColumn<Map<String, String>, String> tableTeam_BelongTeacher = new TableColumn<Map<String, String>, String>("BelongTeacher");
		tableTeam_BelongTeacher.setMinWidth("BelongTeacher".length()*10);
		tableTeam_BelongTeacher.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("BelongTeacher"));
		    }
		});	
		tableTeam.getColumns().add(tableTeam_BelongTeacher);
		
		//table data
		ObservableList<Map<String, String>> dataTeam = FXCollections.observableArrayList();
		List<Team> rsTeam = EntityManager.getAllInstancesOf("Team");
		for (Team r : rsTeam) {
			//table entry
			Map<String, String> unit = new HashMap<String, String>();
			
			if (r.getId() != null)
				unit.put("Id", String.valueOf(r.getId()));
			else
				unit.put("Id", "");
			if (r.getName() != null)
				unit.put("Name", String.valueOf(r.getName()));
			else
				unit.put("Name", "");
			if (r.getIntroduce() != null)
				unit.put("Introduce", String.valueOf(r.getIntroduce()));
			else
				unit.put("Introduce", "");
			if (r.getBelongTeacher() != null)
				unit.put("BelongTeacher", String.valueOf(r.getBelongTeacher()));
			else
				unit.put("BelongTeacher", "");

			dataTeam.add(unit);
		}
		
		tableTeam.getSelectionModel().selectedIndexProperty().addListener(
							 (observable, oldValue, newValue) ->  { 
							 										 //get selected index
							 										 objectindex = tableTeam.getSelectionModel().getSelectedIndex();
							 			 				 			 System.out.println("select: " + objectindex);

							 			 				 			 //update association object information
							 			 				 			 if (objectindex != -1)
										 			 					 updateAssociation("Team", objectindex);
							 			 				 			 
							 			 				 		  });
		
		tableTeam.setItems(dataTeam);
		allObjectTables.put("Team", tableTeam);
		
		TableView<Map<String, String>> tableGroup = new TableView<Map<String, String>>();

		//super entity attribute column
						
		//attributes table column
		TableColumn<Map<String, String>, String> tableGroup_Id = new TableColumn<Map<String, String>, String>("Id");
		tableGroup_Id.setMinWidth("Id".length()*10);
		tableGroup_Id.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Id"));
		    }
		});	
		tableGroup.getColumns().add(tableGroup_Id);
		TableColumn<Map<String, String>, String> tableGroup_Name = new TableColumn<Map<String, String>, String>("Name");
		tableGroup_Name.setMinWidth("Name".length()*10);
		tableGroup_Name.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Name"));
		    }
		});	
		tableGroup.getColumns().add(tableGroup_Name);
		TableColumn<Map<String, String>, String> tableGroup_Introduce = new TableColumn<Map<String, String>, String>("Introduce");
		tableGroup_Introduce.setMinWidth("Introduce".length()*10);
		tableGroup_Introduce.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Introduce"));
		    }
		});	
		tableGroup.getColumns().add(tableGroup_Introduce);
		TableColumn<Map<String, String>, String> tableGroup_BelongTeam = new TableColumn<Map<String, String>, String>("BelongTeam");
		tableGroup_BelongTeam.setMinWidth("BelongTeam".length()*10);
		tableGroup_BelongTeam.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("BelongTeam"));
		    }
		});	
		tableGroup.getColumns().add(tableGroup_BelongTeam);
		
		//table data
		ObservableList<Map<String, String>> dataGroup = FXCollections.observableArrayList();
		List<Group> rsGroup = EntityManager.getAllInstancesOf("Group");
		for (Group r : rsGroup) {
			//table entry
			Map<String, String> unit = new HashMap<String, String>();
			
			if (r.getId() != null)
				unit.put("Id", String.valueOf(r.getId()));
			else
				unit.put("Id", "");
			if (r.getName() != null)
				unit.put("Name", String.valueOf(r.getName()));
			else
				unit.put("Name", "");
			if (r.getIntroduce() != null)
				unit.put("Introduce", String.valueOf(r.getIntroduce()));
			else
				unit.put("Introduce", "");
			if (r.getBelongTeam() != null)
				unit.put("BelongTeam", String.valueOf(r.getBelongTeam()));
			else
				unit.put("BelongTeam", "");

			dataGroup.add(unit);
		}
		
		tableGroup.getSelectionModel().selectedIndexProperty().addListener(
							 (observable, oldValue, newValue) ->  { 
							 										 //get selected index
							 										 objectindex = tableGroup.getSelectionModel().getSelectedIndex();
							 			 				 			 System.out.println("select: " + objectindex);

							 			 				 			 //update association object information
							 			 				 			 if (objectindex != -1)
										 			 					 updateAssociation("Group", objectindex);
							 			 				 			 
							 			 				 		  });
		
		tableGroup.setItems(dataGroup);
		allObjectTables.put("Group", tableGroup);
		
		TableView<Map<String, String>> tableDaily = new TableView<Map<String, String>>();

		//super entity attribute column
						
		//attributes table column
		TableColumn<Map<String, String>, String> tableDaily_Id = new TableColumn<Map<String, String>, String>("Id");
		tableDaily_Id.setMinWidth("Id".length()*10);
		tableDaily_Id.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Id"));
		    }
		});	
		tableDaily.getColumns().add(tableDaily_Id);
		TableColumn<Map<String, String>, String> tableDaily_Affair = new TableColumn<Map<String, String>, String>("Affair");
		tableDaily_Affair.setMinWidth("Affair".length()*10);
		tableDaily_Affair.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Affair"));
		    }
		});	
		tableDaily.getColumns().add(tableDaily_Affair);
		TableColumn<Map<String, String>, String> tableDaily_Agree = new TableColumn<Map<String, String>, String>("Agree");
		tableDaily_Agree.setMinWidth("Agree".length()*10);
		tableDaily_Agree.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Agree"));
		    }
		});	
		tableDaily.getColumns().add(tableDaily_Agree);
		TableColumn<Map<String, String>, String> tableDaily_BelongGroup = new TableColumn<Map<String, String>, String>("BelongGroup");
		tableDaily_BelongGroup.setMinWidth("BelongGroup".length()*10);
		tableDaily_BelongGroup.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("BelongGroup"));
		    }
		});	
		tableDaily.getColumns().add(tableDaily_BelongGroup);
		TableColumn<Map<String, String>, String> tableDaily_BelongUser = new TableColumn<Map<String, String>, String>("BelongUser");
		tableDaily_BelongUser.setMinWidth("BelongUser".length()*10);
		tableDaily_BelongUser.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("BelongUser"));
		    }
		});	
		tableDaily.getColumns().add(tableDaily_BelongUser);
		TableColumn<Map<String, String>, String> tableDaily_Finish = new TableColumn<Map<String, String>, String>("Finish");
		tableDaily_Finish.setMinWidth("Finish".length()*10);
		tableDaily_Finish.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Finish"));
		    }
		});	
		tableDaily.getColumns().add(tableDaily_Finish);
		TableColumn<Map<String, String>, String> tableDaily_Content = new TableColumn<Map<String, String>, String>("Content");
		tableDaily_Content.setMinWidth("Content".length()*10);
		tableDaily_Content.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Content"));
		    }
		});	
		tableDaily.getColumns().add(tableDaily_Content);
		
		//table data
		ObservableList<Map<String, String>> dataDaily = FXCollections.observableArrayList();
		List<Daily> rsDaily = EntityManager.getAllInstancesOf("Daily");
		for (Daily r : rsDaily) {
			//table entry
			Map<String, String> unit = new HashMap<String, String>();
			
			if (r.getId() != null)
				unit.put("Id", String.valueOf(r.getId()));
			else
				unit.put("Id", "");
			unit.put("Affair", String.valueOf(r.getAffair()));
			unit.put("Agree", String.valueOf(r.getAgree()));
			if (r.getBelongGroup() != null)
				unit.put("BelongGroup", String.valueOf(r.getBelongGroup()));
			else
				unit.put("BelongGroup", "");
			if (r.getBelongUser() != null)
				unit.put("BelongUser", String.valueOf(r.getBelongUser()));
			else
				unit.put("BelongUser", "");
			unit.put("Finish", String.valueOf(r.getFinish()));
			if (r.getContent() != null)
				unit.put("Content", String.valueOf(r.getContent()));
			else
				unit.put("Content", "");

			dataDaily.add(unit);
		}
		
		tableDaily.getSelectionModel().selectedIndexProperty().addListener(
							 (observable, oldValue, newValue) ->  { 
							 										 //get selected index
							 										 objectindex = tableDaily.getSelectionModel().getSelectedIndex();
							 			 				 			 System.out.println("select: " + objectindex);

							 			 				 			 //update association object information
							 			 				 			 if (objectindex != -1)
										 			 					 updateAssociation("Daily", objectindex);
							 			 				 			 
							 			 				 		  });
		
		tableDaily.setItems(dataDaily);
		allObjectTables.put("Daily", tableDaily);
		
		TableView<Map<String, String>> tablePlan = new TableView<Map<String, String>>();

		//super entity attribute column
						
		//attributes table column
		TableColumn<Map<String, String>, String> tablePlan_Content = new TableColumn<Map<String, String>, String>("Content");
		tablePlan_Content.setMinWidth("Content".length()*10);
		tablePlan_Content.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Content"));
		    }
		});	
		tablePlan.getColumns().add(tablePlan_Content);
		TableColumn<Map<String, String>, String> tablePlan_BelongGroup = new TableColumn<Map<String, String>, String>("BelongGroup");
		tablePlan_BelongGroup.setMinWidth("BelongGroup".length()*10);
		tablePlan_BelongGroup.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("BelongGroup"));
		    }
		});	
		tablePlan.getColumns().add(tablePlan_BelongGroup);
		TableColumn<Map<String, String>, String> tablePlan_BelongUser = new TableColumn<Map<String, String>, String>("BelongUser");
		tablePlan_BelongUser.setMinWidth("BelongUser".length()*10);
		tablePlan_BelongUser.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("BelongUser"));
		    }
		});	
		tablePlan.getColumns().add(tablePlan_BelongUser);
		TableColumn<Map<String, String>, String> tablePlan_Id = new TableColumn<Map<String, String>, String>("Id");
		tablePlan_Id.setMinWidth("Id".length()*10);
		tablePlan_Id.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Id"));
		    }
		});	
		tablePlan.getColumns().add(tablePlan_Id);
		TableColumn<Map<String, String>, String> tablePlan_Finish = new TableColumn<Map<String, String>, String>("Finish");
		tablePlan_Finish.setMinWidth("Finish".length()*10);
		tablePlan_Finish.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("Finish"));
		    }
		});	
		tablePlan.getColumns().add(tablePlan_Finish);
		
		//table data
		ObservableList<Map<String, String>> dataPlan = FXCollections.observableArrayList();
		List<Plan> rsPlan = EntityManager.getAllInstancesOf("Plan");
		for (Plan r : rsPlan) {
			//table entry
			Map<String, String> unit = new HashMap<String, String>();
			
			if (r.getContent() != null)
				unit.put("Content", String.valueOf(r.getContent()));
			else
				unit.put("Content", "");
			if (r.getBelongGroup() != null)
				unit.put("BelongGroup", String.valueOf(r.getBelongGroup()));
			else
				unit.put("BelongGroup", "");
			if (r.getBelongUser() != null)
				unit.put("BelongUser", String.valueOf(r.getBelongUser()));
			else
				unit.put("BelongUser", "");
			if (r.getId() != null)
				unit.put("Id", String.valueOf(r.getId()));
			else
				unit.put("Id", "");
			unit.put("Finish", String.valueOf(r.getFinish()));

			dataPlan.add(unit);
		}
		
		tablePlan.getSelectionModel().selectedIndexProperty().addListener(
							 (observable, oldValue, newValue) ->  { 
							 										 //get selected index
							 										 objectindex = tablePlan.getSelectionModel().getSelectedIndex();
							 			 				 			 System.out.println("select: " + objectindex);

							 			 				 			 //update association object information
							 			 				 			 if (objectindex != -1)
										 			 					 updateAssociation("Plan", objectindex);
							 			 				 			 
							 			 				 		  });
		
		tablePlan.setItems(dataPlan);
		allObjectTables.put("Plan", tablePlan);
		
		TableView<Map<String, String>> tableApply = new TableView<Map<String, String>>();

		//super entity attribute column
						
		//attributes table column
		TableColumn<Map<String, String>, String> tableApply_BelongStudent = new TableColumn<Map<String, String>, String>("BelongStudent");
		tableApply_BelongStudent.setMinWidth("BelongStudent".length()*10);
		tableApply_BelongStudent.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("BelongStudent"));
		    }
		});	
		tableApply.getColumns().add(tableApply_BelongStudent);
		TableColumn<Map<String, String>, String> tableApply_ApplyType = new TableColumn<Map<String, String>, String>("ApplyType");
		tableApply_ApplyType.setMinWidth("ApplyType".length()*10);
		tableApply_ApplyType.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("ApplyType"));
		    }
		});	
		tableApply.getColumns().add(tableApply_ApplyType);
		TableColumn<Map<String, String>, String> tableApply_AimId = new TableColumn<Map<String, String>, String>("AimId");
		tableApply_AimId.setMinWidth("AimId".length()*10);
		tableApply_AimId.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("AimId"));
		    }
		});	
		tableApply.getColumns().add(tableApply_AimId);
		
		//table data
		ObservableList<Map<String, String>> dataApply = FXCollections.observableArrayList();
		List<Apply> rsApply = EntityManager.getAllInstancesOf("Apply");
		for (Apply r : rsApply) {
			//table entry
			Map<String, String> unit = new HashMap<String, String>();
			
			if (r.getBelongStudent() != null)
				unit.put("BelongStudent", String.valueOf(r.getBelongStudent()));
			else
				unit.put("BelongStudent", "");
			unit.put("ApplyType", String.valueOf(r.getApplyType()));
			if (r.getAimId() != null)
				unit.put("AimId", String.valueOf(r.getAimId()));
			else
				unit.put("AimId", "");

			dataApply.add(unit);
		}
		
		tableApply.getSelectionModel().selectedIndexProperty().addListener(
							 (observable, oldValue, newValue) ->  { 
							 										 //get selected index
							 										 objectindex = tableApply.getSelectionModel().getSelectedIndex();
							 			 				 			 System.out.println("select: " + objectindex);

							 			 				 			 //update association object information
							 			 				 			 if (objectindex != -1)
										 			 					 updateAssociation("Apply", objectindex);
							 			 				 			 
							 			 				 		  });
		
		tableApply.setItems(dataApply);
		allObjectTables.put("Apply", tableApply);
		
		TableView<Map<String, String>> tableStudentInTeam = new TableView<Map<String, String>>();

		//super entity attribute column
						
		//attributes table column
		TableColumn<Map<String, String>, String> tableStudentInTeam_TeamId = new TableColumn<Map<String, String>, String>("TeamId");
		tableStudentInTeam_TeamId.setMinWidth("TeamId".length()*10);
		tableStudentInTeam_TeamId.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("TeamId"));
		    }
		});	
		tableStudentInTeam.getColumns().add(tableStudentInTeam_TeamId);
		TableColumn<Map<String, String>, String> tableStudentInTeam_StudentId = new TableColumn<Map<String, String>, String>("StudentId");
		tableStudentInTeam_StudentId.setMinWidth("StudentId".length()*10);
		tableStudentInTeam_StudentId.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("StudentId"));
		    }
		});	
		tableStudentInTeam.getColumns().add(tableStudentInTeam_StudentId);
		
		//table data
		ObservableList<Map<String, String>> dataStudentInTeam = FXCollections.observableArrayList();
		List<StudentInTeam> rsStudentInTeam = EntityManager.getAllInstancesOf("StudentInTeam");
		for (StudentInTeam r : rsStudentInTeam) {
			//table entry
			Map<String, String> unit = new HashMap<String, String>();
			
			if (r.getTeamId() != null)
				unit.put("TeamId", String.valueOf(r.getTeamId()));
			else
				unit.put("TeamId", "");
			if (r.getStudentId() != null)
				unit.put("StudentId", String.valueOf(r.getStudentId()));
			else
				unit.put("StudentId", "");

			dataStudentInTeam.add(unit);
		}
		
		tableStudentInTeam.getSelectionModel().selectedIndexProperty().addListener(
							 (observable, oldValue, newValue) ->  { 
							 										 //get selected index
							 										 objectindex = tableStudentInTeam.getSelectionModel().getSelectedIndex();
							 			 				 			 System.out.println("select: " + objectindex);

							 			 				 			 //update association object information
							 			 				 			 if (objectindex != -1)
										 			 					 updateAssociation("StudentInTeam", objectindex);
							 			 				 			 
							 			 				 		  });
		
		tableStudentInTeam.setItems(dataStudentInTeam);
		allObjectTables.put("StudentInTeam", tableStudentInTeam);
		
		TableView<Map<String, String>> tableStudentInGroup = new TableView<Map<String, String>>();

		//super entity attribute column
						
		//attributes table column
		TableColumn<Map<String, String>, String> tableStudentInGroup_GroupId = new TableColumn<Map<String, String>, String>("GroupId");
		tableStudentInGroup_GroupId.setMinWidth("GroupId".length()*10);
		tableStudentInGroup_GroupId.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("GroupId"));
		    }
		});	
		tableStudentInGroup.getColumns().add(tableStudentInGroup_GroupId);
		TableColumn<Map<String, String>, String> tableStudentInGroup_StudentId = new TableColumn<Map<String, String>, String>("StudentId");
		tableStudentInGroup_StudentId.setMinWidth("StudentId".length()*10);
		tableStudentInGroup_StudentId.setCellValueFactory(new Callback<CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {	   
			@Override
		    public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> data) {
		        return new ReadOnlyStringWrapper(data.getValue().get("StudentId"));
		    }
		});	
		tableStudentInGroup.getColumns().add(tableStudentInGroup_StudentId);
		
		//table data
		ObservableList<Map<String, String>> dataStudentInGroup = FXCollections.observableArrayList();
		List<StudentInGroup> rsStudentInGroup = EntityManager.getAllInstancesOf("StudentInGroup");
		for (StudentInGroup r : rsStudentInGroup) {
			//table entry
			Map<String, String> unit = new HashMap<String, String>();
			
			if (r.getGroupId() != null)
				unit.put("GroupId", String.valueOf(r.getGroupId()));
			else
				unit.put("GroupId", "");
			if (r.getStudentId() != null)
				unit.put("StudentId", String.valueOf(r.getStudentId()));
			else
				unit.put("StudentId", "");

			dataStudentInGroup.add(unit);
		}
		
		tableStudentInGroup.getSelectionModel().selectedIndexProperty().addListener(
							 (observable, oldValue, newValue) ->  { 
							 										 //get selected index
							 										 objectindex = tableStudentInGroup.getSelectionModel().getSelectedIndex();
							 			 				 			 System.out.println("select: " + objectindex);

							 			 				 			 //update association object information
							 			 				 			 if (objectindex != -1)
										 			 					 updateAssociation("StudentInGroup", objectindex);
							 			 				 			 
							 			 				 		  });
		
		tableStudentInGroup.setItems(dataStudentInGroup);
		allObjectTables.put("StudentInGroup", tableStudentInGroup);
		

		
	}
	
	/* 
	* update all object tables with sub dataset
	*/ 
	public void updateUserTable(List<User> rsUser) {
			ObservableList<Map<String, String>> dataUser = FXCollections.observableArrayList();
			for (User r : rsUser) {
				Map<String, String> unit = new HashMap<String, String>();
				
				
				if (r.getId() != null)
					unit.put("Id", String.valueOf(r.getId()));
				else
					unit.put("Id", "");
				if (r.getUsername() != null)
					unit.put("Username", String.valueOf(r.getUsername()));
				else
					unit.put("Username", "");
				if (r.getPassword() != null)
					unit.put("Password", String.valueOf(r.getPassword()));
				else
					unit.put("Password", "");
				unit.put("Identity", String.valueOf(r.getIdentity()));
				dataUser.add(unit);
			}
			
			allObjectTables.get("User").setItems(dataUser);
	}
	public void updateStudentTable(List<Student> rsStudent) {
			ObservableList<Map<String, String>> dataStudent = FXCollections.observableArrayList();
			for (Student r : rsStudent) {
				Map<String, String> unit = new HashMap<String, String>();
				
				if (r.getId() != null)
					unit.put("Id", String.valueOf(r.getId()));
				else
					unit.put("Id", "");
				if (r.getUsername() != null)
					unit.put("Username", String.valueOf(r.getUsername()));
				else
					unit.put("Username", "");
				if (r.getPassword() != null)
					unit.put("Password", String.valueOf(r.getPassword()));
				else
					unit.put("Password", "");
				unit.put("Identity", String.valueOf(r.getIdentity()));
				
				if (r.getClassName() != null)
					unit.put("ClassName", String.valueOf(r.getClassName()));
				else
					unit.put("ClassName", "");
				dataStudent.add(unit);
			}
			
			allObjectTables.get("Student").setItems(dataStudent);
	}
	public void updateTeacherTable(List<Teacher> rsTeacher) {
			ObservableList<Map<String, String>> dataTeacher = FXCollections.observableArrayList();
			for (Teacher r : rsTeacher) {
				Map<String, String> unit = new HashMap<String, String>();
				
				if (r.getId() != null)
					unit.put("Id", String.valueOf(r.getId()));
				else
					unit.put("Id", "");
				if (r.getUsername() != null)
					unit.put("Username", String.valueOf(r.getUsername()));
				else
					unit.put("Username", "");
				if (r.getPassword() != null)
					unit.put("Password", String.valueOf(r.getPassword()));
				else
					unit.put("Password", "");
				unit.put("Identity", String.valueOf(r.getIdentity()));
				
				if (r.getIntroduce() != null)
					unit.put("Introduce", String.valueOf(r.getIntroduce()));
				else
					unit.put("Introduce", "");
				dataTeacher.add(unit);
			}
			
			allObjectTables.get("Teacher").setItems(dataTeacher);
	}
	public void updateManagerTable(List<Manager> rsManager) {
			ObservableList<Map<String, String>> dataManager = FXCollections.observableArrayList();
			for (Manager r : rsManager) {
				Map<String, String> unit = new HashMap<String, String>();
				
				if (r.getId() != null)
					unit.put("Id", String.valueOf(r.getId()));
				else
					unit.put("Id", "");
				if (r.getUsername() != null)
					unit.put("Username", String.valueOf(r.getUsername()));
				else
					unit.put("Username", "");
				if (r.getPassword() != null)
					unit.put("Password", String.valueOf(r.getPassword()));
				else
					unit.put("Password", "");
				unit.put("Identity", String.valueOf(r.getIdentity()));
				
				if (r.getDepartment() != null)
					unit.put("Department", String.valueOf(r.getDepartment()));
				else
					unit.put("Department", "");
				dataManager.add(unit);
			}
			
			allObjectTables.get("Manager").setItems(dataManager);
	}
	public void updateTeamTable(List<Team> rsTeam) {
			ObservableList<Map<String, String>> dataTeam = FXCollections.observableArrayList();
			for (Team r : rsTeam) {
				Map<String, String> unit = new HashMap<String, String>();
				
				
				if (r.getId() != null)
					unit.put("Id", String.valueOf(r.getId()));
				else
					unit.put("Id", "");
				if (r.getName() != null)
					unit.put("Name", String.valueOf(r.getName()));
				else
					unit.put("Name", "");
				if (r.getIntroduce() != null)
					unit.put("Introduce", String.valueOf(r.getIntroduce()));
				else
					unit.put("Introduce", "");
				if (r.getBelongTeacher() != null)
					unit.put("BelongTeacher", String.valueOf(r.getBelongTeacher()));
				else
					unit.put("BelongTeacher", "");
				dataTeam.add(unit);
			}
			
			allObjectTables.get("Team").setItems(dataTeam);
	}
	public void updateGroupTable(List<Group> rsGroup) {
			ObservableList<Map<String, String>> dataGroup = FXCollections.observableArrayList();
			for (Group r : rsGroup) {
				Map<String, String> unit = new HashMap<String, String>();
				
				
				if (r.getId() != null)
					unit.put("Id", String.valueOf(r.getId()));
				else
					unit.put("Id", "");
				if (r.getName() != null)
					unit.put("Name", String.valueOf(r.getName()));
				else
					unit.put("Name", "");
				if (r.getIntroduce() != null)
					unit.put("Introduce", String.valueOf(r.getIntroduce()));
				else
					unit.put("Introduce", "");
				if (r.getBelongTeam() != null)
					unit.put("BelongTeam", String.valueOf(r.getBelongTeam()));
				else
					unit.put("BelongTeam", "");
				dataGroup.add(unit);
			}
			
			allObjectTables.get("Group").setItems(dataGroup);
	}
	public void updateDailyTable(List<Daily> rsDaily) {
			ObservableList<Map<String, String>> dataDaily = FXCollections.observableArrayList();
			for (Daily r : rsDaily) {
				Map<String, String> unit = new HashMap<String, String>();
				
				
				if (r.getId() != null)
					unit.put("Id", String.valueOf(r.getId()));
				else
					unit.put("Id", "");
				unit.put("Affair", String.valueOf(r.getAffair()));
				unit.put("Agree", String.valueOf(r.getAgree()));
				if (r.getBelongGroup() != null)
					unit.put("BelongGroup", String.valueOf(r.getBelongGroup()));
				else
					unit.put("BelongGroup", "");
				if (r.getBelongUser() != null)
					unit.put("BelongUser", String.valueOf(r.getBelongUser()));
				else
					unit.put("BelongUser", "");
				unit.put("Finish", String.valueOf(r.getFinish()));
				if (r.getContent() != null)
					unit.put("Content", String.valueOf(r.getContent()));
				else
					unit.put("Content", "");
				dataDaily.add(unit);
			}
			
			allObjectTables.get("Daily").setItems(dataDaily);
	}
	public void updatePlanTable(List<Plan> rsPlan) {
			ObservableList<Map<String, String>> dataPlan = FXCollections.observableArrayList();
			for (Plan r : rsPlan) {
				Map<String, String> unit = new HashMap<String, String>();
				
				
				if (r.getContent() != null)
					unit.put("Content", String.valueOf(r.getContent()));
				else
					unit.put("Content", "");
				if (r.getBelongGroup() != null)
					unit.put("BelongGroup", String.valueOf(r.getBelongGroup()));
				else
					unit.put("BelongGroup", "");
				if (r.getBelongUser() != null)
					unit.put("BelongUser", String.valueOf(r.getBelongUser()));
				else
					unit.put("BelongUser", "");
				if (r.getId() != null)
					unit.put("Id", String.valueOf(r.getId()));
				else
					unit.put("Id", "");
				unit.put("Finish", String.valueOf(r.getFinish()));
				dataPlan.add(unit);
			}
			
			allObjectTables.get("Plan").setItems(dataPlan);
	}
	public void updateApplyTable(List<Apply> rsApply) {
			ObservableList<Map<String, String>> dataApply = FXCollections.observableArrayList();
			for (Apply r : rsApply) {
				Map<String, String> unit = new HashMap<String, String>();
				
				
				if (r.getBelongStudent() != null)
					unit.put("BelongStudent", String.valueOf(r.getBelongStudent()));
				else
					unit.put("BelongStudent", "");
				unit.put("ApplyType", String.valueOf(r.getApplyType()));
				if (r.getAimId() != null)
					unit.put("AimId", String.valueOf(r.getAimId()));
				else
					unit.put("AimId", "");
				dataApply.add(unit);
			}
			
			allObjectTables.get("Apply").setItems(dataApply);
	}
	public void updateStudentInTeamTable(List<StudentInTeam> rsStudentInTeam) {
			ObservableList<Map<String, String>> dataStudentInTeam = FXCollections.observableArrayList();
			for (StudentInTeam r : rsStudentInTeam) {
				Map<String, String> unit = new HashMap<String, String>();
				
				
				if (r.getTeamId() != null)
					unit.put("TeamId", String.valueOf(r.getTeamId()));
				else
					unit.put("TeamId", "");
				if (r.getStudentId() != null)
					unit.put("StudentId", String.valueOf(r.getStudentId()));
				else
					unit.put("StudentId", "");
				dataStudentInTeam.add(unit);
			}
			
			allObjectTables.get("StudentInTeam").setItems(dataStudentInTeam);
	}
	public void updateStudentInGroupTable(List<StudentInGroup> rsStudentInGroup) {
			ObservableList<Map<String, String>> dataStudentInGroup = FXCollections.observableArrayList();
			for (StudentInGroup r : rsStudentInGroup) {
				Map<String, String> unit = new HashMap<String, String>();
				
				
				if (r.getGroupId() != null)
					unit.put("GroupId", String.valueOf(r.getGroupId()));
				else
					unit.put("GroupId", "");
				if (r.getStudentId() != null)
					unit.put("StudentId", String.valueOf(r.getStudentId()));
				else
					unit.put("StudentId", "");
				dataStudentInGroup.add(unit);
			}
			
			allObjectTables.get("StudentInGroup").setItems(dataStudentInGroup);
	}
	
	/* 
	* update all object tables
	*/ 
	public void updateUserTable() {
			ObservableList<Map<String, String>> dataUser = FXCollections.observableArrayList();
			List<User> rsUser = EntityManager.getAllInstancesOf("User");
			for (User r : rsUser) {
				Map<String, String> unit = new HashMap<String, String>();


				if (r.getId() != null)
					unit.put("Id", String.valueOf(r.getId()));
				else
					unit.put("Id", "");
				if (r.getUsername() != null)
					unit.put("Username", String.valueOf(r.getUsername()));
				else
					unit.put("Username", "");
				if (r.getPassword() != null)
					unit.put("Password", String.valueOf(r.getPassword()));
				else
					unit.put("Password", "");
				unit.put("Identity", String.valueOf(r.getIdentity()));
				dataUser.add(unit);
			}
			
			allObjectTables.get("User").setItems(dataUser);
	}
	public void updateStudentTable() {
			ObservableList<Map<String, String>> dataStudent = FXCollections.observableArrayList();
			List<Student> rsStudent = EntityManager.getAllInstancesOf("Student");
			for (Student r : rsStudent) {
				Map<String, String> unit = new HashMap<String, String>();

				if (r.getId() != null)
					unit.put("Id", String.valueOf(r.getId()));
				else
					unit.put("Id", "");
				if (r.getUsername() != null)
					unit.put("Username", String.valueOf(r.getUsername()));
				else
					unit.put("Username", "");
				if (r.getPassword() != null)
					unit.put("Password", String.valueOf(r.getPassword()));
				else
					unit.put("Password", "");
				unit.put("Identity", String.valueOf(r.getIdentity()));

				if (r.getClassName() != null)
					unit.put("ClassName", String.valueOf(r.getClassName()));
				else
					unit.put("ClassName", "");
				dataStudent.add(unit);
			}
			
			allObjectTables.get("Student").setItems(dataStudent);
	}
	public void updateTeacherTable() {
			ObservableList<Map<String, String>> dataTeacher = FXCollections.observableArrayList();
			List<Teacher> rsTeacher = EntityManager.getAllInstancesOf("Teacher");
			for (Teacher r : rsTeacher) {
				Map<String, String> unit = new HashMap<String, String>();

				if (r.getId() != null)
					unit.put("Id", String.valueOf(r.getId()));
				else
					unit.put("Id", "");
				if (r.getUsername() != null)
					unit.put("Username", String.valueOf(r.getUsername()));
				else
					unit.put("Username", "");
				if (r.getPassword() != null)
					unit.put("Password", String.valueOf(r.getPassword()));
				else
					unit.put("Password", "");
				unit.put("Identity", String.valueOf(r.getIdentity()));

				if (r.getIntroduce() != null)
					unit.put("Introduce", String.valueOf(r.getIntroduce()));
				else
					unit.put("Introduce", "");
				dataTeacher.add(unit);
			}
			
			allObjectTables.get("Teacher").setItems(dataTeacher);
	}
	public void updateManagerTable() {
			ObservableList<Map<String, String>> dataManager = FXCollections.observableArrayList();
			List<Manager> rsManager = EntityManager.getAllInstancesOf("Manager");
			for (Manager r : rsManager) {
				Map<String, String> unit = new HashMap<String, String>();

				if (r.getId() != null)
					unit.put("Id", String.valueOf(r.getId()));
				else
					unit.put("Id", "");
				if (r.getUsername() != null)
					unit.put("Username", String.valueOf(r.getUsername()));
				else
					unit.put("Username", "");
				if (r.getPassword() != null)
					unit.put("Password", String.valueOf(r.getPassword()));
				else
					unit.put("Password", "");
				unit.put("Identity", String.valueOf(r.getIdentity()));

				if (r.getDepartment() != null)
					unit.put("Department", String.valueOf(r.getDepartment()));
				else
					unit.put("Department", "");
				dataManager.add(unit);
			}
			
			allObjectTables.get("Manager").setItems(dataManager);
	}
	public void updateTeamTable() {
			ObservableList<Map<String, String>> dataTeam = FXCollections.observableArrayList();
			List<Team> rsTeam = EntityManager.getAllInstancesOf("Team");
			for (Team r : rsTeam) {
				Map<String, String> unit = new HashMap<String, String>();


				if (r.getId() != null)
					unit.put("Id", String.valueOf(r.getId()));
				else
					unit.put("Id", "");
				if (r.getName() != null)
					unit.put("Name", String.valueOf(r.getName()));
				else
					unit.put("Name", "");
				if (r.getIntroduce() != null)
					unit.put("Introduce", String.valueOf(r.getIntroduce()));
				else
					unit.put("Introduce", "");
				if (r.getBelongTeacher() != null)
					unit.put("BelongTeacher", String.valueOf(r.getBelongTeacher()));
				else
					unit.put("BelongTeacher", "");
				dataTeam.add(unit);
			}
			
			allObjectTables.get("Team").setItems(dataTeam);
	}
	public void updateGroupTable() {
			ObservableList<Map<String, String>> dataGroup = FXCollections.observableArrayList();
			List<Group> rsGroup = EntityManager.getAllInstancesOf("Group");
			for (Group r : rsGroup) {
				Map<String, String> unit = new HashMap<String, String>();


				if (r.getId() != null)
					unit.put("Id", String.valueOf(r.getId()));
				else
					unit.put("Id", "");
				if (r.getName() != null)
					unit.put("Name", String.valueOf(r.getName()));
				else
					unit.put("Name", "");
				if (r.getIntroduce() != null)
					unit.put("Introduce", String.valueOf(r.getIntroduce()));
				else
					unit.put("Introduce", "");
				if (r.getBelongTeam() != null)
					unit.put("BelongTeam", String.valueOf(r.getBelongTeam()));
				else
					unit.put("BelongTeam", "");
				dataGroup.add(unit);
			}
			
			allObjectTables.get("Group").setItems(dataGroup);
	}
	public void updateDailyTable() {
			ObservableList<Map<String, String>> dataDaily = FXCollections.observableArrayList();
			List<Daily> rsDaily = EntityManager.getAllInstancesOf("Daily");
			for (Daily r : rsDaily) {
				Map<String, String> unit = new HashMap<String, String>();


				if (r.getId() != null)
					unit.put("Id", String.valueOf(r.getId()));
				else
					unit.put("Id", "");
				unit.put("Affair", String.valueOf(r.getAffair()));
				unit.put("Agree", String.valueOf(r.getAgree()));
				if (r.getBelongGroup() != null)
					unit.put("BelongGroup", String.valueOf(r.getBelongGroup()));
				else
					unit.put("BelongGroup", "");
				if (r.getBelongUser() != null)
					unit.put("BelongUser", String.valueOf(r.getBelongUser()));
				else
					unit.put("BelongUser", "");
				unit.put("Finish", String.valueOf(r.getFinish()));
				if (r.getContent() != null)
					unit.put("Content", String.valueOf(r.getContent()));
				else
					unit.put("Content", "");
				dataDaily.add(unit);
			}
			
			allObjectTables.get("Daily").setItems(dataDaily);
	}
	public void updatePlanTable() {
			ObservableList<Map<String, String>> dataPlan = FXCollections.observableArrayList();
			List<Plan> rsPlan = EntityManager.getAllInstancesOf("Plan");
			for (Plan r : rsPlan) {
				Map<String, String> unit = new HashMap<String, String>();


				if (r.getContent() != null)
					unit.put("Content", String.valueOf(r.getContent()));
				else
					unit.put("Content", "");
				if (r.getBelongGroup() != null)
					unit.put("BelongGroup", String.valueOf(r.getBelongGroup()));
				else
					unit.put("BelongGroup", "");
				if (r.getBelongUser() != null)
					unit.put("BelongUser", String.valueOf(r.getBelongUser()));
				else
					unit.put("BelongUser", "");
				if (r.getId() != null)
					unit.put("Id", String.valueOf(r.getId()));
				else
					unit.put("Id", "");
				unit.put("Finish", String.valueOf(r.getFinish()));
				dataPlan.add(unit);
			}
			
			allObjectTables.get("Plan").setItems(dataPlan);
	}
	public void updateApplyTable() {
			ObservableList<Map<String, String>> dataApply = FXCollections.observableArrayList();
			List<Apply> rsApply = EntityManager.getAllInstancesOf("Apply");
			for (Apply r : rsApply) {
				Map<String, String> unit = new HashMap<String, String>();


				if (r.getBelongStudent() != null)
					unit.put("BelongStudent", String.valueOf(r.getBelongStudent()));
				else
					unit.put("BelongStudent", "");
				unit.put("ApplyType", String.valueOf(r.getApplyType()));
				if (r.getAimId() != null)
					unit.put("AimId", String.valueOf(r.getAimId()));
				else
					unit.put("AimId", "");
				dataApply.add(unit);
			}
			
			allObjectTables.get("Apply").setItems(dataApply);
	}
	public void updateStudentInTeamTable() {
			ObservableList<Map<String, String>> dataStudentInTeam = FXCollections.observableArrayList();
			List<StudentInTeam> rsStudentInTeam = EntityManager.getAllInstancesOf("StudentInTeam");
			for (StudentInTeam r : rsStudentInTeam) {
				Map<String, String> unit = new HashMap<String, String>();


				if (r.getTeamId() != null)
					unit.put("TeamId", String.valueOf(r.getTeamId()));
				else
					unit.put("TeamId", "");
				if (r.getStudentId() != null)
					unit.put("StudentId", String.valueOf(r.getStudentId()));
				else
					unit.put("StudentId", "");
				dataStudentInTeam.add(unit);
			}
			
			allObjectTables.get("StudentInTeam").setItems(dataStudentInTeam);
	}
	public void updateStudentInGroupTable() {
			ObservableList<Map<String, String>> dataStudentInGroup = FXCollections.observableArrayList();
			List<StudentInGroup> rsStudentInGroup = EntityManager.getAllInstancesOf("StudentInGroup");
			for (StudentInGroup r : rsStudentInGroup) {
				Map<String, String> unit = new HashMap<String, String>();


				if (r.getGroupId() != null)
					unit.put("GroupId", String.valueOf(r.getGroupId()));
				else
					unit.put("GroupId", "");
				if (r.getStudentId() != null)
					unit.put("StudentId", String.valueOf(r.getStudentId()));
				else
					unit.put("StudentId", "");
				dataStudentInGroup.add(unit);
			}
			
			allObjectTables.get("StudentInGroup").setItems(dataStudentInGroup);
	}
	
	public void classStatisicBingding() {
	
		 classInfodata = FXCollections.observableArrayList();
	 	 user = new ClassInfo("User", EntityManager.getAllInstancesOf("User").size());
	 	 classInfodata.add(user);
	 	 student = new ClassInfo("Student", EntityManager.getAllInstancesOf("Student").size());
	 	 classInfodata.add(student);
	 	 teacher = new ClassInfo("Teacher", EntityManager.getAllInstancesOf("Teacher").size());
	 	 classInfodata.add(teacher);
	 	 manager = new ClassInfo("Manager", EntityManager.getAllInstancesOf("Manager").size());
	 	 classInfodata.add(manager);
	 	 team = new ClassInfo("Team", EntityManager.getAllInstancesOf("Team").size());
	 	 classInfodata.add(team);
	 	 group = new ClassInfo("Group", EntityManager.getAllInstancesOf("Group").size());
	 	 classInfodata.add(group);
	 	 daily = new ClassInfo("Daily", EntityManager.getAllInstancesOf("Daily").size());
	 	 classInfodata.add(daily);
	 	 plan = new ClassInfo("Plan", EntityManager.getAllInstancesOf("Plan").size());
	 	 classInfodata.add(plan);
	 	 apply = new ClassInfo("Apply", EntityManager.getAllInstancesOf("Apply").size());
	 	 classInfodata.add(apply);
	 	 studentinteam = new ClassInfo("StudentInTeam", EntityManager.getAllInstancesOf("StudentInTeam").size());
	 	 classInfodata.add(studentinteam);
	 	 studentingroup = new ClassInfo("StudentInGroup", EntityManager.getAllInstancesOf("StudentInGroup").size());
	 	 classInfodata.add(studentingroup);
	 	 
		 class_statisic.setItems(classInfodata);
		 
		 //Class Statisic Binding
		 class_statisic.getSelectionModel().selectedItemProperty().addListener(
				 (observable, oldValue, newValue) ->  { 
				 										 //no selected object in table
				 										 objectindex = -1;
				 										 
				 										 //get lastest data, reflect updateTableData method
				 										 try {
												 			 Method updateob = this.getClass().getMethod("update" + newValue.getName() + "Table", null);
												 			 updateob.invoke(this);			 
												 		 } catch (Exception e) {
												 		 	 e.printStackTrace();
												 		 }		 										 
				 	
				 										 //show object table
				 			 				 			 TableView obs = allObjectTables.get(newValue.getName());
				 			 				 			 if (obs != null) {
				 			 				 				object_statics.setContent(obs);
				 			 				 				object_statics.setText("All Objects " + newValue.getName() + ":");
				 			 				 			 }
				 			 				 			 
				 			 				 			 //update association information
							 			 				 updateAssociation(newValue.getName());
				 			 				 			 
				 			 				 			 //show association information
				 			 				 			 ObservableList<AssociationInfo> asso = allassociationData.get(newValue.getName());
				 			 				 			 if (asso != null) {
				 			 				 			 	association_statisic.setItems(asso);
				 			 				 			 }
				 			 				 		  });
	}
	
	public void classStatisticUpdate() {
	 	 user.setNumber(EntityManager.getAllInstancesOf("User").size());
	 	 student.setNumber(EntityManager.getAllInstancesOf("Student").size());
	 	 teacher.setNumber(EntityManager.getAllInstancesOf("Teacher").size());
	 	 manager.setNumber(EntityManager.getAllInstancesOf("Manager").size());
	 	 team.setNumber(EntityManager.getAllInstancesOf("Team").size());
	 	 group.setNumber(EntityManager.getAllInstancesOf("Group").size());
	 	 daily.setNumber(EntityManager.getAllInstancesOf("Daily").size());
	 	 plan.setNumber(EntityManager.getAllInstancesOf("Plan").size());
	 	 apply.setNumber(EntityManager.getAllInstancesOf("Apply").size());
	 	 studentinteam.setNumber(EntityManager.getAllInstancesOf("StudentInTeam").size());
	 	 studentingroup.setNumber(EntityManager.getAllInstancesOf("StudentInGroup").size());
		
	}
	
	/**
	 * association binding
	 */
	public void associationStatisicBingding() {
		
		allassociationData = new HashMap<String, ObservableList<AssociationInfo>>();
		
		ObservableList<AssociationInfo> User_association_data = FXCollections.observableArrayList();
		
		allassociationData.put("User", User_association_data);
		
		ObservableList<AssociationInfo> Student_association_data = FXCollections.observableArrayList();
		AssociationInfo Student_associatition_StudentOwnDaily = new AssociationInfo("Student", "Daily", "StudentOwnDaily", true);
		Student_association_data.add(Student_associatition_StudentOwnDaily);
		AssociationInfo Student_associatition_StudentOwnPlan = new AssociationInfo("Student", "Plan", "StudentOwnPlan", true);
		Student_association_data.add(Student_associatition_StudentOwnPlan);
		AssociationInfo Student_associatition_StudentOwnApply = new AssociationInfo("Student", "Apply", "StudentOwnApply", true);
		Student_association_data.add(Student_associatition_StudentOwnApply);
		AssociationInfo Student_associatition_StudentInTeamLink = new AssociationInfo("Student", "StudentInTeam", "StudentInTeamLink", true);
		Student_association_data.add(Student_associatition_StudentInTeamLink);
		AssociationInfo Student_associatition_StudentInGroupLink = new AssociationInfo("Student", "StudentInGroup", "StudentInGroupLink", true);
		Student_association_data.add(Student_associatition_StudentInGroupLink);
		
		allassociationData.put("Student", Student_association_data);
		
		ObservableList<AssociationInfo> Teacher_association_data = FXCollections.observableArrayList();
		AssociationInfo Teacher_associatition_TeacherOwnTeam = new AssociationInfo("Teacher", "Team", "TeacherOwnTeam", true);
		Teacher_association_data.add(Teacher_associatition_TeacherOwnTeam);
		AssociationInfo Teacher_associatition_TeacherHandleDaily = new AssociationInfo("Teacher", "Daily", "TeacherHandleDaily", true);
		Teacher_association_data.add(Teacher_associatition_TeacherHandleDaily);
		AssociationInfo Teacher_associatition_TeacherHandlePlan = new AssociationInfo("Teacher", "Plan", "TeacherHandlePlan", true);
		Teacher_association_data.add(Teacher_associatition_TeacherHandlePlan);
		
		allassociationData.put("Teacher", Teacher_association_data);
		
		ObservableList<AssociationInfo> Manager_association_data = FXCollections.observableArrayList();
		
		allassociationData.put("Manager", Manager_association_data);
		
		ObservableList<AssociationInfo> Team_association_data = FXCollections.observableArrayList();
		AssociationInfo Team_associatition_TeamBelongTeacher = new AssociationInfo("Team", "Teacher", "TeamBelongTeacher", false);
		Team_association_data.add(Team_associatition_TeamBelongTeacher);
		AssociationInfo Team_associatition_TeamHasStudent = new AssociationInfo("Team", "Student", "TeamHasStudent", true);
		Team_association_data.add(Team_associatition_TeamHasStudent);
		AssociationInfo Team_associatition_TeamHasStudentLink = new AssociationInfo("Team", "StudentInTeam", "TeamHasStudentLink", true);
		Team_association_data.add(Team_associatition_TeamHasStudentLink);
		
		allassociationData.put("Team", Team_association_data);
		
		ObservableList<AssociationInfo> Group_association_data = FXCollections.observableArrayList();
		AssociationInfo Group_associatition_GroupBelongTeam = new AssociationInfo("Group", "Team", "GroupBelongTeam", true);
		Group_association_data.add(Group_associatition_GroupBelongTeam);
		AssociationInfo Group_associatition_GroupHasStudent = new AssociationInfo("Group", "Student", "GroupHasStudent", true);
		Group_association_data.add(Group_associatition_GroupHasStudent);
		AssociationInfo Group_associatition_GroupHasStudentLink = new AssociationInfo("Group", "StudentInGroup", "GroupHasStudentLink", true);
		Group_association_data.add(Group_associatition_GroupHasStudentLink);
		
		allassociationData.put("Group", Group_association_data);
		
		ObservableList<AssociationInfo> Daily_association_data = FXCollections.observableArrayList();
		AssociationInfo Daily_associatition_DailyBelongStudent = new AssociationInfo("Daily", "Student", "DailyBelongStudent", false);
		Daily_association_data.add(Daily_associatition_DailyBelongStudent);
		AssociationInfo Daily_associatition_DailytoTeacher = new AssociationInfo("Daily", "Teacher", "DailytoTeacher", false);
		Daily_association_data.add(Daily_associatition_DailytoTeacher);
		
		allassociationData.put("Daily", Daily_association_data);
		
		ObservableList<AssociationInfo> Plan_association_data = FXCollections.observableArrayList();
		AssociationInfo Plan_associatition_PlanBelongStudent = new AssociationInfo("Plan", "Student", "PlanBelongStudent", false);
		Plan_association_data.add(Plan_associatition_PlanBelongStudent);
		AssociationInfo Plan_associatition_PlantoTeacher = new AssociationInfo("Plan", "Teacher", "PlantoTeacher", false);
		Plan_association_data.add(Plan_associatition_PlantoTeacher);
		
		allassociationData.put("Plan", Plan_association_data);
		
		ObservableList<AssociationInfo> Apply_association_data = FXCollections.observableArrayList();
		AssociationInfo Apply_associatition_ApplytoStudent = new AssociationInfo("Apply", "Student", "ApplytoStudent", false);
		Apply_association_data.add(Apply_associatition_ApplytoStudent);
		
		allassociationData.put("Apply", Apply_association_data);
		
		ObservableList<AssociationInfo> StudentInTeam_association_data = FXCollections.observableArrayList();
		AssociationInfo StudentInTeam_associatition_TeamHasStudent = new AssociationInfo("StudentInTeam", "Student", "TeamHasStudent", true);
		StudentInTeam_association_data.add(StudentInTeam_associatition_TeamHasStudent);
		AssociationInfo StudentInTeam_associatition_StudentInTeam = new AssociationInfo("StudentInTeam", "Team", "StudentInTeam", true);
		StudentInTeam_association_data.add(StudentInTeam_associatition_StudentInTeam);
		
		allassociationData.put("StudentInTeam", StudentInTeam_association_data);
		
		ObservableList<AssociationInfo> StudentInGroup_association_data = FXCollections.observableArrayList();
		AssociationInfo StudentInGroup_associatition_GroupHasStudent = new AssociationInfo("StudentInGroup", "Student", "GroupHasStudent", true);
		StudentInGroup_association_data.add(StudentInGroup_associatition_GroupHasStudent);
		AssociationInfo StudentInGroup_associatition_StudentInGroup = new AssociationInfo("StudentInGroup", "Group", "StudentInGroup", true);
		StudentInGroup_association_data.add(StudentInGroup_associatition_StudentInGroup);
		
		allassociationData.put("StudentInGroup", StudentInGroup_association_data);
		
		
		association_statisic.getSelectionModel().selectedItemProperty().addListener(
			    (observable, oldValue, newValue) ->  { 
	
							 		if (newValue != null) {
							 			 try {
							 			 	 if (newValue.getNumber() != 0) {
								 				 //choose object or not
								 				 if (objectindex != -1) {
									 				 Class[] cArg = new Class[1];
									 				 cArg[0] = List.class;
									 				 //reflect updateTableData method
										 			 Method updateob = this.getClass().getMethod("update" + newValue.getTargetClass() + "Table", cArg);
										 			 //find choosen object
										 			 Object selectedob = EntityManager.getAllInstancesOf(newValue.getSourceClass()).get(objectindex);
										 			 //reflect find association method
										 			 Method getAssociatedObject = selectedob.getClass().getMethod("get" + newValue.getAssociationName());
										 			 List r = new LinkedList();
										 			 //one or mulity?
										 			 if (newValue.getIsMultiple() == true) {
											 			 
											 			r = (List) getAssociatedObject.invoke(selectedob);
										 			 }
										 			 else {
										 				r.add(getAssociatedObject.invoke(selectedob));
										 			 }
										 			 //invoke update method
										 			 updateob.invoke(this, r);
										 			  
										 			 
								 				 }
												 //bind updated data to GUI
					 				 			 TableView obs = allObjectTables.get(newValue.getTargetClass());
					 				 			 if (obs != null) {
					 				 				object_statics.setContent(obs);
					 				 				object_statics.setText("Targets Objects " + newValue.getTargetClass() + ":");
					 				 			 }
					 				 		 }
							 			 }
							 			 catch (Exception e) {
							 				 e.printStackTrace();
							 			 }
							 		}
					 		  });
		
	}	
	
	

    //prepare data for contract
	public void prepareData() {
		
		//definition map
		definitions_map = new HashMap<String, String>();
		definitions_map.put("createAccount", "user:User = User.allInstance()->any(u:User | u.Id = id)\r\r\n");
		definitions_map.put("createTeam", "user:User = User.allInstance()->any(u:User | u.Id = userId)\n\rteam:Team = Team.allInstance()->any(t:Team | t.Id = id)\r\r\n");
		definitions_map.put("createGroup", "team:Team = Team.allInstance()->any(t:Team | t.Id = teamId)\n\rgroup:Group = Group.allInstance()->any(g:Group | g.Id = id)\r\r\n");
		definitions_map.put("handleTeamApply", "apply:Apply = Apply.allInstance()->any(a:Apply | a.AimId = teamId and a.ApplyType = ApplyType :: JOINTEAM)\r\r\n");
		definitions_map.put("handleGroupApply", "apply:Apply = Apply.allInstance()->any(a:Apply | a.AimId = groupId and a.ApplyType = ApplyType :: JOINGROUP)\r\r\n");
		definitions_map.put("dismissGroup", "group:Group = Group.allInstance()->any(g:Group | g.Id = groupId)\n\rsig:StudentInGroup = StudentInGroup.allInstance()->any(s:StudentInGroup | s.GroupId = groupId)\r\r\n");
		definitions_map.put("dismissTeam", "team:Team = Team.allInstance()->any(t:Team | t.Id = teamId)\n\rsit:StudentInTeam = StudentInTeam.allInstance()->any(s:StudentInTeam | s.TeamId = teamId)\n\rgroup:Group = Group.allInstance()->any(g:Group | g.BelongTeam = teamId)\r\r\n");
		definitions_map.put("applyJoinTeam", "team:Team = Team.allInstance()->any(t:Team | t.Id = teamId)\n\rstu:Student = Student.allInstance()->any(s:Student | s.Id = studentId)\n\rapply:Apply = Apply.allInstance()->any(a:Apply | a.AimId = teamId and a.BelongStudent = studentId and a.ApplyType = ApplyType :: JOINTEAM)\r\r\n");
		definitions_map.put("applyJoinGroup", "group:Group = Group.allInstance()->any(g:Group | g.Id = groupId)\n\rstu:Student = Student.allInstance()->any(s:Student | s.Id = studentId)\n\rapply:Apply = Apply.allInstance()->any(a:Apply | a.AimId = groupId and a.BelongStudent = studentId and a.ApplyType = ApplyType :: JOINGROUP)\n\rteam:Team = Team.allInstance()->any(t:Team | group.oclIsUndefined() = false and t.Id = group.BelongTeam)\r\r\n");
		definitions_map.put("exitGroup", "sig:StudentInGroup = StudentInGroup.allInstance()->any(s:StudentInGroup | s.GroupId = groupId and s.StudentId = studentId)\r\r\n");
		definitions_map.put("exitTeam", "sit:StudentInTeam = StudentInTeam.allInstance()->any(s:StudentInTeam | s.TeamId = teamId and s.StudentId = studentId)\n\rsigs:Set(StudentInGroup) = StudentInGroup.allInstance()->select(s:StudentInGroup | s.StudentId = studentId)\n\rgs:Set(Group) = Group.allInstance()->select(g:Group | g.BelongTeam = teamId)\n\rgit:Group = sigs->any(s:StudentInGroup | gs->exists(g:Group | g.Id = s.GroupId))\r\r\n");
		definitions_map.put("createPlan", "plan:Plan = Plan.allInstance()->any(p:Plan | p.Id = id)\n\rsig:StudentInGroup = StudentInGroup.allInstance()->any(s:StudentInGroup | s.GroupId = groupId and s.StudentId = studentId)\r\r\n");
		definitions_map.put("editPlan", "plan:Plan = Plan.allInstance()->any(p:Plan | p.Id = id)\r\r\n");
		definitions_map.put("finishPlan", "plan:Plan = Plan.allInstance()->any(p:Plan | p.Id = id)\r\r\n");
		definitions_map.put("createDaily", "daily:Daily = Daily.allInstance()->any(d:Daily | d.Id = id)\n\rsig:StudentInGroup = StudentInGroup.allInstance()->any(s:StudentInGroup | s.GroupId = groupId and s.StudentId = studentId)\r\r\n");
		definitions_map.put("editDaily", "daily:Daily = Daily.allInstance()->any(d:Daily | d.Id = id)\r\r\n");
		definitions_map.put("finishDaily", "daily:Daily = Daily.allInstance()->any(d:Daily | d.Id = id)\r\r\n");
		definitions_map.put("deleteDaily", "daily:Daily = Daily.allInstance()->any(d:Daily | d.Id = id and d.Finish = true)\r\r\n");
		definitions_map.put("operateDaily", "daily:Daily = Daily.allInstance()->any(d:Daily | d.Id = id and d.Finish = false)\r\r\n");
		
		//precondition map
		preconditions_map = new HashMap<String, String>();
		preconditions_map.put("createAccount", "user.oclIsUndefined() = true");
		preconditions_map.put("createTeam", "user.oclIsUndefined() = false and\nuser.Identity = IdentityType::TEACHER and\nteam.oclIsUndefined() = true\n");
		preconditions_map.put("createGroup", "team.oclIsUndefined() = false and\ngroup.oclIsUndefined() = true\n");
		preconditions_map.put("handleTeamApply", "apply.oclIsUndefined() = false");
		preconditions_map.put("handleGroupApply", "apply.oclIsUndefined() = false");
		preconditions_map.put("dismissGroup", "group.oclIsUndefined() = false and\nsig.oclIsUndefined() = true\n");
		preconditions_map.put("dismissTeam", "team.oclIsUndefined() = false and\nsit.oclIsUndefined() = true and\ngroup.oclIsUndefined() = true\n");
		preconditions_map.put("applyJoinTeam", "team.oclIsUndefined() = false and\nstu.oclIsUndefined() = false and\napply.oclIsUndefined() = true\n");
		preconditions_map.put("applyJoinGroup", "group.oclIsUndefined() = false and\nteam.oclIsUndefined() = false and\nstu.oclIsUndefined() = false and\napply.oclIsUndefined() = true and\nteam.oclIsUndefined() = false\n");
		preconditions_map.put("exitGroup", "sig.oclIsUndefined() = false");
		preconditions_map.put("exitTeam", "sit.oclIsUndefined() = false and\ngit.oclIsUndefined() = false\n");
		preconditions_map.put("createPlan", "plan.oclIsUndefined() = true and\nsig.oclIsUndefined() = false\n");
		preconditions_map.put("editPlan", "plan.oclIsUndefined() = false");
		preconditions_map.put("finishPlan", "plan.oclIsUndefined() = false");
		preconditions_map.put("createDaily", "daily.oclIsUndefined() = true and\nsig.oclIsUndefined() = false\n");
		preconditions_map.put("editDaily", "daily.oclIsUndefined() = false");
		preconditions_map.put("finishDaily", "daily.oclIsUndefined() = false");
		preconditions_map.put("deleteDaily", "daily.oclIsUndefined() = false");
		preconditions_map.put("operateDaily", "daily.oclIsUndefined() = false");
		
		//postcondition map
		postconditions_map = new HashMap<String, String>();
		postconditions_map.put("createAccount", "let u:User inu.oclIsNew() and\nu.Id = id and\nu.Username = username and\nu.Identity = identity and\nu.Password = password and\nUser.allInstance()->includes(u) and\nresult = true\n");
		postconditions_map.put("createTeam", "let t:Team int.oclIsNew() and\nt.Id = id and\nt.BelongTeacher = userId and\nt.Name = name and\nt.Introduce = message and\nTeam.allInstance()->includes(t) and\nresult = true\n");
		postconditions_map.put("createGroup", "let g:Group ing.oclIsNew() and\ng.Id = id and\ng.BelongTeam = teamId and\ng.Name = name and\ng.Introduce = message and\nGroup.allInstance()->includes(g) and\nresult = true\n");
		postconditions_map.put("handleTeamApply", "let sit:StudentInTeam insit.oclIsNew() and\nif\nagree = true\nthen\nsit.TeamId = teamId and\nsit.StudentId = apply.BelongStudent and\nStudentInTeam.allInstance()->includes(sit) and\nApply.allInstance()->excludes(apply) and\nresult = true\nelse\nApply.allInstance()->excludes(apply) and\nresult = true\nendif\n");
		postconditions_map.put("handleGroupApply", "let sig:StudentInGroup insig.oclIsNew() and\nif\nagree = true\nthen\nsig.GroupId = groupId and\nsig.StudentId = apply.BelongStudent and\nStudentInGroup.allInstance()->includes(sig) and\nApply.allInstance()->excludes(apply) and\nresult = true\nelse\nApply.allInstance()->excludes(apply) and\nresult = true\nendif\n");
		postconditions_map.put("dismissGroup", "Group.allInstance()->excludes(group) and\nresult = true\n");
		postconditions_map.put("dismissTeam", "Team.allInstance()->excludes(team) and\nresult = true\n");
		postconditions_map.put("applyJoinTeam", "let a:Apply ina.oclIsNew() and\na.AimId = teamId and\na.BelongStudent = studentId and\na.ApplyType = ApplyType::JOINTEAM and\nresult = true\n");
		postconditions_map.put("applyJoinGroup", "let a:Apply ina.oclIsNew() and\na.AimId = groupId and\na.BelongStudent = studentId and\na.ApplyType = ApplyType::JOINGROUP and\nresult = true\n");
		postconditions_map.put("exitGroup", "StudentInGroup.allInstance()->excludes(sig) and\nresult = true\n");
		postconditions_map.put("exitTeam", "StudentInTeam.allInstance()->excludes(sit) and\nresult = true\n");
		postconditions_map.put("createPlan", "let p:Plan inp.oclIsNew() and\np.Id = id and\np.BelongUser = studentId and\np.BelongGroup = groupId and\np.Content = content and\np.Finish = false and\nresult = true\n");
		postconditions_map.put("editPlan", "plan.Content = content and\nresult = true\n");
		postconditions_map.put("finishPlan", "plan.Finish = finish and\nresult = true\n");
		postconditions_map.put("createDaily", "let d:Daily ind.oclIsNew() and\nd.Id = id and\nd.BelongUser = studentId and\nd.BelongGroup = groupId and\nd.Affair = type and\nd.Content = content and\nd.Agree = false and\nd.Finish = false and\nresult = true\n");
		postconditions_map.put("editDaily", "daily.Affair = type and\ndaily.Content = content and\nresult = true\n");
		postconditions_map.put("finishDaily", "daily.Finish = true and\nresult = true\n");
		postconditions_map.put("deleteDaily", "Daily.allInstance()->excludes(daily) and\nresult = true\n");
		postconditions_map.put("operateDaily", "daily.Agree = agree and\nresult = true\n");
		
		//service invariants map
		service_invariants_map = new LinkedHashMap<String, String>();
		
		//entity invariants map
		entity_invariants_map = new LinkedHashMap<String, String>();
		
	}
	
	public void generatOperationPane() {
		
		 operationPanels = new LinkedHashMap<String, GridPane>();
		
		 // ==================== GridPane_createAccount ====================
		 GridPane createAccount = new GridPane();
		 createAccount.setHgap(4);
		 createAccount.setVgap(6);
		 createAccount.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> createAccount_content = createAccount.getChildren();
		 Label createAccount_id_label = new Label("id:");
		 createAccount_id_label.setMinWidth(Region.USE_PREF_SIZE);
		 createAccount_content.add(createAccount_id_label);
		 GridPane.setConstraints(createAccount_id_label, 0, 0);
		 
		 createAccount_id_t = new TextField();
		 createAccount_content.add(createAccount_id_t);
		 createAccount_id_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createAccount_id_t, 1, 0);
		 Label createAccount_username_label = new Label("username:");
		 createAccount_username_label.setMinWidth(Region.USE_PREF_SIZE);
		 createAccount_content.add(createAccount_username_label);
		 GridPane.setConstraints(createAccount_username_label, 0, 1);
		 
		 createAccount_username_t = new TextField();
		 createAccount_content.add(createAccount_username_t);
		 createAccount_username_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createAccount_username_t, 1, 1);
		 Label createAccount_identity_label = new Label("identity:");
		 createAccount_identity_label.setMinWidth(Region.USE_PREF_SIZE);
		 createAccount_content.add(createAccount_identity_label);
		 GridPane.setConstraints(createAccount_identity_label, 0, 2);
		 
		 createAccount_identity_cb = new ChoiceBox();
createAccount_identity_cb.getItems().add("MANAGER");
createAccount_identity_cb.getItems().add("TEACHER");
createAccount_identity_cb.getItems().add("STUDENT");
		 createAccount_identity_cb.getSelectionModel().selectFirst();
		 createAccount_content.add(createAccount_identity_cb);
		 GridPane.setConstraints(createAccount_identity_cb, 1, 2);
		 Label createAccount_password_label = new Label("password:");
		 createAccount_password_label.setMinWidth(Region.USE_PREF_SIZE);
		 createAccount_content.add(createAccount_password_label);
		 GridPane.setConstraints(createAccount_password_label, 0, 3);
		 
		 createAccount_password_t = new TextField();
		 createAccount_content.add(createAccount_password_t);
		 createAccount_password_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createAccount_password_t, 1, 3);
		 operationPanels.put("createAccount", createAccount);
		 
		 // ==================== GridPane_createTeam ====================
		 GridPane createTeam = new GridPane();
		 createTeam.setHgap(4);
		 createTeam.setVgap(6);
		 createTeam.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> createTeam_content = createTeam.getChildren();
		 Label createTeam_id_label = new Label("id:");
		 createTeam_id_label.setMinWidth(Region.USE_PREF_SIZE);
		 createTeam_content.add(createTeam_id_label);
		 GridPane.setConstraints(createTeam_id_label, 0, 0);
		 
		 createTeam_id_t = new TextField();
		 createTeam_content.add(createTeam_id_t);
		 createTeam_id_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createTeam_id_t, 1, 0);
		 Label createTeam_userId_label = new Label("userId:");
		 createTeam_userId_label.setMinWidth(Region.USE_PREF_SIZE);
		 createTeam_content.add(createTeam_userId_label);
		 GridPane.setConstraints(createTeam_userId_label, 0, 1);
		 
		 createTeam_userId_t = new TextField();
		 createTeam_content.add(createTeam_userId_t);
		 createTeam_userId_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createTeam_userId_t, 1, 1);
		 Label createTeam_name_label = new Label("name:");
		 createTeam_name_label.setMinWidth(Region.USE_PREF_SIZE);
		 createTeam_content.add(createTeam_name_label);
		 GridPane.setConstraints(createTeam_name_label, 0, 2);
		 
		 createTeam_name_t = new TextField();
		 createTeam_content.add(createTeam_name_t);
		 createTeam_name_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createTeam_name_t, 1, 2);
		 Label createTeam_message_label = new Label("message:");
		 createTeam_message_label.setMinWidth(Region.USE_PREF_SIZE);
		 createTeam_content.add(createTeam_message_label);
		 GridPane.setConstraints(createTeam_message_label, 0, 3);
		 
		 createTeam_message_t = new TextField();
		 createTeam_content.add(createTeam_message_t);
		 createTeam_message_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createTeam_message_t, 1, 3);
		 operationPanels.put("createTeam", createTeam);
		 
		 // ==================== GridPane_createGroup ====================
		 GridPane createGroup = new GridPane();
		 createGroup.setHgap(4);
		 createGroup.setVgap(6);
		 createGroup.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> createGroup_content = createGroup.getChildren();
		 Label createGroup_id_label = new Label("id:");
		 createGroup_id_label.setMinWidth(Region.USE_PREF_SIZE);
		 createGroup_content.add(createGroup_id_label);
		 GridPane.setConstraints(createGroup_id_label, 0, 0);
		 
		 createGroup_id_t = new TextField();
		 createGroup_content.add(createGroup_id_t);
		 createGroup_id_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createGroup_id_t, 1, 0);
		 Label createGroup_teamId_label = new Label("teamId:");
		 createGroup_teamId_label.setMinWidth(Region.USE_PREF_SIZE);
		 createGroup_content.add(createGroup_teamId_label);
		 GridPane.setConstraints(createGroup_teamId_label, 0, 1);
		 
		 createGroup_teamId_t = new TextField();
		 createGroup_content.add(createGroup_teamId_t);
		 createGroup_teamId_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createGroup_teamId_t, 1, 1);
		 Label createGroup_name_label = new Label("name:");
		 createGroup_name_label.setMinWidth(Region.USE_PREF_SIZE);
		 createGroup_content.add(createGroup_name_label);
		 GridPane.setConstraints(createGroup_name_label, 0, 2);
		 
		 createGroup_name_t = new TextField();
		 createGroup_content.add(createGroup_name_t);
		 createGroup_name_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createGroup_name_t, 1, 2);
		 Label createGroup_message_label = new Label("message:");
		 createGroup_message_label.setMinWidth(Region.USE_PREF_SIZE);
		 createGroup_content.add(createGroup_message_label);
		 GridPane.setConstraints(createGroup_message_label, 0, 3);
		 
		 createGroup_message_t = new TextField();
		 createGroup_content.add(createGroup_message_t);
		 createGroup_message_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createGroup_message_t, 1, 3);
		 operationPanels.put("createGroup", createGroup);
		 
		 // ==================== GridPane_handleTeamApply ====================
		 GridPane handleTeamApply = new GridPane();
		 handleTeamApply.setHgap(4);
		 handleTeamApply.setVgap(6);
		 handleTeamApply.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> handleTeamApply_content = handleTeamApply.getChildren();
		 Label handleTeamApply_teamId_label = new Label("teamId:");
		 handleTeamApply_teamId_label.setMinWidth(Region.USE_PREF_SIZE);
		 handleTeamApply_content.add(handleTeamApply_teamId_label);
		 GridPane.setConstraints(handleTeamApply_teamId_label, 0, 0);
		 
		 handleTeamApply_teamId_t = new TextField();
		 handleTeamApply_content.add(handleTeamApply_teamId_t);
		 handleTeamApply_teamId_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(handleTeamApply_teamId_t, 1, 0);
		 Label handleTeamApply_agree_label = new Label("agree:");
		 handleTeamApply_agree_label.setMinWidth(Region.USE_PREF_SIZE);
		 handleTeamApply_content.add(handleTeamApply_agree_label);
		 GridPane.setConstraints(handleTeamApply_agree_label, 0, 1);
		 
		 handleTeamApply_agree_t = new TextField();
		 handleTeamApply_content.add(handleTeamApply_agree_t);
		 handleTeamApply_agree_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(handleTeamApply_agree_t, 1, 1);
		 operationPanels.put("handleTeamApply", handleTeamApply);
		 
		 // ==================== GridPane_handleGroupApply ====================
		 GridPane handleGroupApply = new GridPane();
		 handleGroupApply.setHgap(4);
		 handleGroupApply.setVgap(6);
		 handleGroupApply.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> handleGroupApply_content = handleGroupApply.getChildren();
		 Label handleGroupApply_groupId_label = new Label("groupId:");
		 handleGroupApply_groupId_label.setMinWidth(Region.USE_PREF_SIZE);
		 handleGroupApply_content.add(handleGroupApply_groupId_label);
		 GridPane.setConstraints(handleGroupApply_groupId_label, 0, 0);
		 
		 handleGroupApply_groupId_t = new TextField();
		 handleGroupApply_content.add(handleGroupApply_groupId_t);
		 handleGroupApply_groupId_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(handleGroupApply_groupId_t, 1, 0);
		 Label handleGroupApply_agree_label = new Label("agree:");
		 handleGroupApply_agree_label.setMinWidth(Region.USE_PREF_SIZE);
		 handleGroupApply_content.add(handleGroupApply_agree_label);
		 GridPane.setConstraints(handleGroupApply_agree_label, 0, 1);
		 
		 handleGroupApply_agree_t = new TextField();
		 handleGroupApply_content.add(handleGroupApply_agree_t);
		 handleGroupApply_agree_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(handleGroupApply_agree_t, 1, 1);
		 operationPanels.put("handleGroupApply", handleGroupApply);
		 
		 // ==================== GridPane_dismissGroup ====================
		 GridPane dismissGroup = new GridPane();
		 dismissGroup.setHgap(4);
		 dismissGroup.setVgap(6);
		 dismissGroup.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> dismissGroup_content = dismissGroup.getChildren();
		 Label dismissGroup_groupId_label = new Label("groupId:");
		 dismissGroup_groupId_label.setMinWidth(Region.USE_PREF_SIZE);
		 dismissGroup_content.add(dismissGroup_groupId_label);
		 GridPane.setConstraints(dismissGroup_groupId_label, 0, 0);
		 
		 dismissGroup_groupId_t = new TextField();
		 dismissGroup_content.add(dismissGroup_groupId_t);
		 dismissGroup_groupId_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(dismissGroup_groupId_t, 1, 0);
		 operationPanels.put("dismissGroup", dismissGroup);
		 
		 // ==================== GridPane_dismissTeam ====================
		 GridPane dismissTeam = new GridPane();
		 dismissTeam.setHgap(4);
		 dismissTeam.setVgap(6);
		 dismissTeam.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> dismissTeam_content = dismissTeam.getChildren();
		 Label dismissTeam_teamId_label = new Label("teamId:");
		 dismissTeam_teamId_label.setMinWidth(Region.USE_PREF_SIZE);
		 dismissTeam_content.add(dismissTeam_teamId_label);
		 GridPane.setConstraints(dismissTeam_teamId_label, 0, 0);
		 
		 dismissTeam_teamId_t = new TextField();
		 dismissTeam_content.add(dismissTeam_teamId_t);
		 dismissTeam_teamId_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(dismissTeam_teamId_t, 1, 0);
		 operationPanels.put("dismissTeam", dismissTeam);
		 
		 // ==================== GridPane_applyJoinTeam ====================
		 GridPane applyJoinTeam = new GridPane();
		 applyJoinTeam.setHgap(4);
		 applyJoinTeam.setVgap(6);
		 applyJoinTeam.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> applyJoinTeam_content = applyJoinTeam.getChildren();
		 Label applyJoinTeam_teamId_label = new Label("teamId:");
		 applyJoinTeam_teamId_label.setMinWidth(Region.USE_PREF_SIZE);
		 applyJoinTeam_content.add(applyJoinTeam_teamId_label);
		 GridPane.setConstraints(applyJoinTeam_teamId_label, 0, 0);
		 
		 applyJoinTeam_teamId_t = new TextField();
		 applyJoinTeam_content.add(applyJoinTeam_teamId_t);
		 applyJoinTeam_teamId_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(applyJoinTeam_teamId_t, 1, 0);
		 Label applyJoinTeam_studentId_label = new Label("studentId:");
		 applyJoinTeam_studentId_label.setMinWidth(Region.USE_PREF_SIZE);
		 applyJoinTeam_content.add(applyJoinTeam_studentId_label);
		 GridPane.setConstraints(applyJoinTeam_studentId_label, 0, 1);
		 
		 applyJoinTeam_studentId_t = new TextField();
		 applyJoinTeam_content.add(applyJoinTeam_studentId_t);
		 applyJoinTeam_studentId_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(applyJoinTeam_studentId_t, 1, 1);
		 operationPanels.put("applyJoinTeam", applyJoinTeam);
		 
		 // ==================== GridPane_applyJoinGroup ====================
		 GridPane applyJoinGroup = new GridPane();
		 applyJoinGroup.setHgap(4);
		 applyJoinGroup.setVgap(6);
		 applyJoinGroup.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> applyJoinGroup_content = applyJoinGroup.getChildren();
		 Label applyJoinGroup_groupId_label = new Label("groupId:");
		 applyJoinGroup_groupId_label.setMinWidth(Region.USE_PREF_SIZE);
		 applyJoinGroup_content.add(applyJoinGroup_groupId_label);
		 GridPane.setConstraints(applyJoinGroup_groupId_label, 0, 0);
		 
		 applyJoinGroup_groupId_t = new TextField();
		 applyJoinGroup_content.add(applyJoinGroup_groupId_t);
		 applyJoinGroup_groupId_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(applyJoinGroup_groupId_t, 1, 0);
		 Label applyJoinGroup_studentId_label = new Label("studentId:");
		 applyJoinGroup_studentId_label.setMinWidth(Region.USE_PREF_SIZE);
		 applyJoinGroup_content.add(applyJoinGroup_studentId_label);
		 GridPane.setConstraints(applyJoinGroup_studentId_label, 0, 1);
		 
		 applyJoinGroup_studentId_t = new TextField();
		 applyJoinGroup_content.add(applyJoinGroup_studentId_t);
		 applyJoinGroup_studentId_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(applyJoinGroup_studentId_t, 1, 1);
		 operationPanels.put("applyJoinGroup", applyJoinGroup);
		 
		 // ==================== GridPane_exitGroup ====================
		 GridPane exitGroup = new GridPane();
		 exitGroup.setHgap(4);
		 exitGroup.setVgap(6);
		 exitGroup.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> exitGroup_content = exitGroup.getChildren();
		 Label exitGroup_groupId_label = new Label("groupId:");
		 exitGroup_groupId_label.setMinWidth(Region.USE_PREF_SIZE);
		 exitGroup_content.add(exitGroup_groupId_label);
		 GridPane.setConstraints(exitGroup_groupId_label, 0, 0);
		 
		 exitGroup_groupId_t = new TextField();
		 exitGroup_content.add(exitGroup_groupId_t);
		 exitGroup_groupId_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(exitGroup_groupId_t, 1, 0);
		 Label exitGroup_studentId_label = new Label("studentId:");
		 exitGroup_studentId_label.setMinWidth(Region.USE_PREF_SIZE);
		 exitGroup_content.add(exitGroup_studentId_label);
		 GridPane.setConstraints(exitGroup_studentId_label, 0, 1);
		 
		 exitGroup_studentId_t = new TextField();
		 exitGroup_content.add(exitGroup_studentId_t);
		 exitGroup_studentId_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(exitGroup_studentId_t, 1, 1);
		 operationPanels.put("exitGroup", exitGroup);
		 
		 // ==================== GridPane_exitTeam ====================
		 GridPane exitTeam = new GridPane();
		 exitTeam.setHgap(4);
		 exitTeam.setVgap(6);
		 exitTeam.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> exitTeam_content = exitTeam.getChildren();
		 Label exitTeam_teamId_label = new Label("teamId:");
		 exitTeam_teamId_label.setMinWidth(Region.USE_PREF_SIZE);
		 exitTeam_content.add(exitTeam_teamId_label);
		 GridPane.setConstraints(exitTeam_teamId_label, 0, 0);
		 
		 exitTeam_teamId_t = new TextField();
		 exitTeam_content.add(exitTeam_teamId_t);
		 exitTeam_teamId_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(exitTeam_teamId_t, 1, 0);
		 Label exitTeam_studentId_label = new Label("studentId:");
		 exitTeam_studentId_label.setMinWidth(Region.USE_PREF_SIZE);
		 exitTeam_content.add(exitTeam_studentId_label);
		 GridPane.setConstraints(exitTeam_studentId_label, 0, 1);
		 
		 exitTeam_studentId_t = new TextField();
		 exitTeam_content.add(exitTeam_studentId_t);
		 exitTeam_studentId_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(exitTeam_studentId_t, 1, 1);
		 operationPanels.put("exitTeam", exitTeam);
		 
		 // ==================== GridPane_createPlan ====================
		 GridPane createPlan = new GridPane();
		 createPlan.setHgap(4);
		 createPlan.setVgap(6);
		 createPlan.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> createPlan_content = createPlan.getChildren();
		 Label createPlan_groupId_label = new Label("groupId:");
		 createPlan_groupId_label.setMinWidth(Region.USE_PREF_SIZE);
		 createPlan_content.add(createPlan_groupId_label);
		 GridPane.setConstraints(createPlan_groupId_label, 0, 0);
		 
		 createPlan_groupId_t = new TextField();
		 createPlan_content.add(createPlan_groupId_t);
		 createPlan_groupId_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createPlan_groupId_t, 1, 0);
		 Label createPlan_id_label = new Label("id:");
		 createPlan_id_label.setMinWidth(Region.USE_PREF_SIZE);
		 createPlan_content.add(createPlan_id_label);
		 GridPane.setConstraints(createPlan_id_label, 0, 1);
		 
		 createPlan_id_t = new TextField();
		 createPlan_content.add(createPlan_id_t);
		 createPlan_id_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createPlan_id_t, 1, 1);
		 Label createPlan_studentId_label = new Label("studentId:");
		 createPlan_studentId_label.setMinWidth(Region.USE_PREF_SIZE);
		 createPlan_content.add(createPlan_studentId_label);
		 GridPane.setConstraints(createPlan_studentId_label, 0, 2);
		 
		 createPlan_studentId_t = new TextField();
		 createPlan_content.add(createPlan_studentId_t);
		 createPlan_studentId_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createPlan_studentId_t, 1, 2);
		 Label createPlan_content_label = new Label("content:");
		 createPlan_content_label.setMinWidth(Region.USE_PREF_SIZE);
		 createPlan_content.add(createPlan_content_label);
		 GridPane.setConstraints(createPlan_content_label, 0, 3);
		 
		 createPlan_content_t = new TextField();
		 createPlan_content.add(createPlan_content_t);
		 createPlan_content_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createPlan_content_t, 1, 3);
		 Label createPlan_finish_label = new Label("finish:");
		 createPlan_finish_label.setMinWidth(Region.USE_PREF_SIZE);
		 createPlan_content.add(createPlan_finish_label);
		 GridPane.setConstraints(createPlan_finish_label, 0, 4);
		 
		 createPlan_finish_t = new TextField();
		 createPlan_content.add(createPlan_finish_t);
		 createPlan_finish_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createPlan_finish_t, 1, 4);
		 operationPanels.put("createPlan", createPlan);
		 
		 // ==================== GridPane_editPlan ====================
		 GridPane editPlan = new GridPane();
		 editPlan.setHgap(4);
		 editPlan.setVgap(6);
		 editPlan.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> editPlan_content = editPlan.getChildren();
		 Label editPlan_id_label = new Label("id:");
		 editPlan_id_label.setMinWidth(Region.USE_PREF_SIZE);
		 editPlan_content.add(editPlan_id_label);
		 GridPane.setConstraints(editPlan_id_label, 0, 0);
		 
		 editPlan_id_t = new TextField();
		 editPlan_content.add(editPlan_id_t);
		 editPlan_id_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(editPlan_id_t, 1, 0);
		 Label editPlan_content_label = new Label("content:");
		 editPlan_content_label.setMinWidth(Region.USE_PREF_SIZE);
		 editPlan_content.add(editPlan_content_label);
		 GridPane.setConstraints(editPlan_content_label, 0, 1);
		 
		 editPlan_content_t = new TextField();
		 editPlan_content.add(editPlan_content_t);
		 editPlan_content_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(editPlan_content_t, 1, 1);
		 operationPanels.put("editPlan", editPlan);
		 
		 // ==================== GridPane_finishPlan ====================
		 GridPane finishPlan = new GridPane();
		 finishPlan.setHgap(4);
		 finishPlan.setVgap(6);
		 finishPlan.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> finishPlan_content = finishPlan.getChildren();
		 Label finishPlan_id_label = new Label("id:");
		 finishPlan_id_label.setMinWidth(Region.USE_PREF_SIZE);
		 finishPlan_content.add(finishPlan_id_label);
		 GridPane.setConstraints(finishPlan_id_label, 0, 0);
		 
		 finishPlan_id_t = new TextField();
		 finishPlan_content.add(finishPlan_id_t);
		 finishPlan_id_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(finishPlan_id_t, 1, 0);
		 Label finishPlan_finish_label = new Label("finish:");
		 finishPlan_finish_label.setMinWidth(Region.USE_PREF_SIZE);
		 finishPlan_content.add(finishPlan_finish_label);
		 GridPane.setConstraints(finishPlan_finish_label, 0, 1);
		 
		 finishPlan_finish_t = new TextField();
		 finishPlan_content.add(finishPlan_finish_t);
		 finishPlan_finish_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(finishPlan_finish_t, 1, 1);
		 operationPanels.put("finishPlan", finishPlan);
		 
		 // ==================== GridPane_createDaily ====================
		 GridPane createDaily = new GridPane();
		 createDaily.setHgap(4);
		 createDaily.setVgap(6);
		 createDaily.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> createDaily_content = createDaily.getChildren();
		 Label createDaily_id_label = new Label("id:");
		 createDaily_id_label.setMinWidth(Region.USE_PREF_SIZE);
		 createDaily_content.add(createDaily_id_label);
		 GridPane.setConstraints(createDaily_id_label, 0, 0);
		 
		 createDaily_id_t = new TextField();
		 createDaily_content.add(createDaily_id_t);
		 createDaily_id_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createDaily_id_t, 1, 0);
		 Label createDaily_type_label = new Label("type:");
		 createDaily_type_label.setMinWidth(Region.USE_PREF_SIZE);
		 createDaily_content.add(createDaily_type_label);
		 GridPane.setConstraints(createDaily_type_label, 0, 1);
		 
		 createDaily_type_cb = new ChoiceBox();
createDaily_type_cb.getItems().add("LEAVE");
createDaily_type_cb.getItems().add("BORROW");
createDaily_type_cb.getItems().add("STATION");
		 createDaily_type_cb.getSelectionModel().selectFirst();
		 createDaily_content.add(createDaily_type_cb);
		 GridPane.setConstraints(createDaily_type_cb, 1, 1);
		 Label createDaily_groupId_label = new Label("groupId:");
		 createDaily_groupId_label.setMinWidth(Region.USE_PREF_SIZE);
		 createDaily_content.add(createDaily_groupId_label);
		 GridPane.setConstraints(createDaily_groupId_label, 0, 2);
		 
		 createDaily_groupId_t = new TextField();
		 createDaily_content.add(createDaily_groupId_t);
		 createDaily_groupId_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createDaily_groupId_t, 1, 2);
		 Label createDaily_studentId_label = new Label("studentId:");
		 createDaily_studentId_label.setMinWidth(Region.USE_PREF_SIZE);
		 createDaily_content.add(createDaily_studentId_label);
		 GridPane.setConstraints(createDaily_studentId_label, 0, 3);
		 
		 createDaily_studentId_t = new TextField();
		 createDaily_content.add(createDaily_studentId_t);
		 createDaily_studentId_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createDaily_studentId_t, 1, 3);
		 Label createDaily_content_label = new Label("content:");
		 createDaily_content_label.setMinWidth(Region.USE_PREF_SIZE);
		 createDaily_content.add(createDaily_content_label);
		 GridPane.setConstraints(createDaily_content_label, 0, 4);
		 
		 createDaily_content_t = new TextField();
		 createDaily_content.add(createDaily_content_t);
		 createDaily_content_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(createDaily_content_t, 1, 4);
		 operationPanels.put("createDaily", createDaily);
		 
		 // ==================== GridPane_editDaily ====================
		 GridPane editDaily = new GridPane();
		 editDaily.setHgap(4);
		 editDaily.setVgap(6);
		 editDaily.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> editDaily_content = editDaily.getChildren();
		 Label editDaily_id_label = new Label("id:");
		 editDaily_id_label.setMinWidth(Region.USE_PREF_SIZE);
		 editDaily_content.add(editDaily_id_label);
		 GridPane.setConstraints(editDaily_id_label, 0, 0);
		 
		 editDaily_id_t = new TextField();
		 editDaily_content.add(editDaily_id_t);
		 editDaily_id_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(editDaily_id_t, 1, 0);
		 Label editDaily_type_label = new Label("type:");
		 editDaily_type_label.setMinWidth(Region.USE_PREF_SIZE);
		 editDaily_content.add(editDaily_type_label);
		 GridPane.setConstraints(editDaily_type_label, 0, 1);
		 
		 editDaily_type_cb = new ChoiceBox();
editDaily_type_cb.getItems().add("LEAVE");
editDaily_type_cb.getItems().add("BORROW");
editDaily_type_cb.getItems().add("STATION");
		 editDaily_type_cb.getSelectionModel().selectFirst();
		 editDaily_content.add(editDaily_type_cb);
		 GridPane.setConstraints(editDaily_type_cb, 1, 1);
		 Label editDaily_content_label = new Label("content:");
		 editDaily_content_label.setMinWidth(Region.USE_PREF_SIZE);
		 editDaily_content.add(editDaily_content_label);
		 GridPane.setConstraints(editDaily_content_label, 0, 2);
		 
		 editDaily_content_t = new TextField();
		 editDaily_content.add(editDaily_content_t);
		 editDaily_content_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(editDaily_content_t, 1, 2);
		 operationPanels.put("editDaily", editDaily);
		 
		 // ==================== GridPane_finishDaily ====================
		 GridPane finishDaily = new GridPane();
		 finishDaily.setHgap(4);
		 finishDaily.setVgap(6);
		 finishDaily.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> finishDaily_content = finishDaily.getChildren();
		 Label finishDaily_id_label = new Label("id:");
		 finishDaily_id_label.setMinWidth(Region.USE_PREF_SIZE);
		 finishDaily_content.add(finishDaily_id_label);
		 GridPane.setConstraints(finishDaily_id_label, 0, 0);
		 
		 finishDaily_id_t = new TextField();
		 finishDaily_content.add(finishDaily_id_t);
		 finishDaily_id_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(finishDaily_id_t, 1, 0);
		 operationPanels.put("finishDaily", finishDaily);
		 
		 // ==================== GridPane_deleteDaily ====================
		 GridPane deleteDaily = new GridPane();
		 deleteDaily.setHgap(4);
		 deleteDaily.setVgap(6);
		 deleteDaily.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> deleteDaily_content = deleteDaily.getChildren();
		 Label deleteDaily_id_label = new Label("id:");
		 deleteDaily_id_label.setMinWidth(Region.USE_PREF_SIZE);
		 deleteDaily_content.add(deleteDaily_id_label);
		 GridPane.setConstraints(deleteDaily_id_label, 0, 0);
		 
		 deleteDaily_id_t = new TextField();
		 deleteDaily_content.add(deleteDaily_id_t);
		 deleteDaily_id_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(deleteDaily_id_t, 1, 0);
		 operationPanels.put("deleteDaily", deleteDaily);
		 
		 // ==================== GridPane_operateDaily ====================
		 GridPane operateDaily = new GridPane();
		 operateDaily.setHgap(4);
		 operateDaily.setVgap(6);
		 operateDaily.setPadding(new Insets(8, 8, 8, 8));
		 
		 ObservableList<Node> operateDaily_content = operateDaily.getChildren();
		 Label operateDaily_id_label = new Label("id:");
		 operateDaily_id_label.setMinWidth(Region.USE_PREF_SIZE);
		 operateDaily_content.add(operateDaily_id_label);
		 GridPane.setConstraints(operateDaily_id_label, 0, 0);
		 
		 operateDaily_id_t = new TextField();
		 operateDaily_content.add(operateDaily_id_t);
		 operateDaily_id_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(operateDaily_id_t, 1, 0);
		 Label operateDaily_agree_label = new Label("agree:");
		 operateDaily_agree_label.setMinWidth(Region.USE_PREF_SIZE);
		 operateDaily_content.add(operateDaily_agree_label);
		 GridPane.setConstraints(operateDaily_agree_label, 0, 1);
		 
		 operateDaily_agree_t = new TextField();
		 operateDaily_content.add(operateDaily_agree_t);
		 operateDaily_agree_t.setMinWidth(Region.USE_PREF_SIZE);
		 GridPane.setConstraints(operateDaily_agree_t, 1, 1);
		 operationPanels.put("operateDaily", operateDaily);
		 
	}	

	public void actorTreeViewBinding() {
		
		 

		TreeItem<String> treeRootadministrator = new TreeItem<String>("Root node");
		
		TreeItem<String> subTreeRoot_User = new TreeItem<String>("manageUser");
					 		subTreeRoot_User.getChildren().addAll(Arrays.asList(					 		
					 			 		new TreeItem<String>("createUser"),
					 			 		new TreeItem<String>("queryUser"),
					 			 		new TreeItem<String>("modifyUser"),
					 			 		new TreeItem<String>("deleteUser")					 			 	
					 			 	));							 		
		TreeItem<String> subTreeRoot_Student = new TreeItem<String>("manageStudent");
					 		subTreeRoot_Student.getChildren().addAll(Arrays.asList(					 		
					 			 		new TreeItem<String>("createStudent"),
					 			 		new TreeItem<String>("queryStudent"),
					 			 		new TreeItem<String>("modifyStudent"),
					 			 		new TreeItem<String>("deleteStudent")					 			 	
					 			 	));							 		
		TreeItem<String> subTreeRoot_Teacher = new TreeItem<String>("manageTeacher");
					 		subTreeRoot_Teacher.getChildren().addAll(Arrays.asList(					 		
					 			 		new TreeItem<String>("createTeacher"),
					 			 		new TreeItem<String>("queryTeacher"),
					 			 		new TreeItem<String>("modifyTeacher"),
					 			 		new TreeItem<String>("deleteTeacher")					 			 	
					 			 	));							 		
		TreeItem<String> subTreeRoot_Manager = new TreeItem<String>("manageManager");
					 		subTreeRoot_Manager.getChildren().addAll(Arrays.asList(					 		
					 			 		new TreeItem<String>("createManager"),
					 			 		new TreeItem<String>("queryManager"),
					 			 		new TreeItem<String>("modifyManager"),
					 			 		new TreeItem<String>("deleteManager")					 			 	
					 			 	));							 		
		
					 			
						 		
		treeRootadministrator.getChildren().addAll(Arrays.asList(
		 	subTreeRoot_User,
		 	subTreeRoot_Student,
		 	subTreeRoot_Teacher,
		 	subTreeRoot_Manager
				));	
				
	 			treeRootadministrator.setExpanded(true);

		actor_treeview_administrator.setShowRoot(false);
		actor_treeview_administrator.setRoot(treeRootadministrator);
	 		
		actor_treeview_administrator.getSelectionModel().selectedItemProperty().addListener(
		 				 (observable, oldValue, newValue) -> { 
		 				 								
		 				 							 //clear the previous return
		 											 operation_return_pane.setContent(new Label());
		 											 
		 				 							 clickedOp = newValue.getValue();
		 				 							 GridPane op = operationPanels.get(clickedOp);
		 				 							 VBox vb = opInvariantPanel.get(clickedOp);
		 				 							 
		 				 							 //op pannel
		 				 							 if (op != null) {
		 				 								 operation_paras.setContent(operationPanels.get(newValue.getValue()));
		 				 								 
		 				 								 ObservableList<Node> l = operationPanels.get(newValue.getValue()).getChildren();
		 				 								 choosenOperation = new LinkedList<TextField>();
		 				 								 for (Node n : l) {
		 				 								 	 if (n instanceof TextField) {
		 				 								 	 	choosenOperation.add((TextField)n);
		 				 								 	  }
		 				 								 }
		 				 								 
		 				 								 definition.setText(definitions_map.get(newValue.getValue()));
		 				 								 precondition.setText(preconditions_map.get(newValue.getValue()));
		 				 								 postcondition.setText(postconditions_map.get(newValue.getValue()));
		 				 								 
		 				 						     }
		 				 							 else {
		 				 								 Label l = new Label(newValue.getValue() + " is no contract information in requirement model.");
		 				 								 l.setPadding(new Insets(8, 8, 8, 8));
		 				 								 operation_paras.setContent(l);
		 				 							 }	
		 				 							 
		 				 							 //op invariants
		 				 							 if (vb != null) {
		 				 							 	ScrollPane scrollPane = new ScrollPane(vb);
		 				 							 	scrollPane.setFitToWidth(true);
		 				 							 	invariants_panes.setMaxHeight(200); 
		 				 							 	//all_invariant_pane.setContent(scrollPane);	
		 				 							 	
		 				 							 	invariants_panes.setContent(scrollPane);
		 				 							 } else {
		 				 							 	 Label l = new Label(newValue.getValue() + " is no related invariants");
		 				 							     l.setPadding(new Insets(8, 8, 8, 8));
		 				 							     invariants_panes.setContent(l);
		 				 							 }
		 				 							 
		 				 							 //reset pre- and post-conditions area color
		 				 							 precondition.setStyle("-fx-background-color:#FFFFFF; -fx-control-inner-background: #FFFFFF ");
		 				 							 postcondition.setStyle("-fx-background-color:#FFFFFF; -fx-control-inner-background: #FFFFFF");
		 				 							 //reset condition panel title
		 				 							 precondition_pane.setText("Precondition");
		 				 							 postcondition_pane.setText("Postcondition");
		 				 						} 
		 				 				);

		
		
		 
		TreeItem<String> treeRootcomuser = new TreeItem<String>("Root node");
		
		treeRootcomuser.getChildren().addAll(Arrays.asList(
			new TreeItem<String>("operateAccount")
					));
		
		treeRootcomuser.setExpanded(true);

		actor_treeview_comuser.setShowRoot(false);
		actor_treeview_comuser.setRoot(treeRootcomuser);
		
		//TreeView click, then open the GridPane for inputing parameters
		actor_treeview_comuser.getSelectionModel().selectedItemProperty().addListener(
						 (observable, oldValue, newValue) -> { 
						 								
						 							 //clear the previous return
													 operation_return_pane.setContent(new Label());
													 
						 							 clickedOp = newValue.getValue();
						 							 GridPane op = operationPanels.get(clickedOp);
						 							 VBox vb = opInvariantPanel.get(clickedOp);
						 							 
						 							 //op pannel
						 							 if (op != null) {
						 								 operation_paras.setContent(operationPanels.get(newValue.getValue()));
						 								 
						 								 ObservableList<Node> l = operationPanels.get(newValue.getValue()).getChildren();
						 								 choosenOperation = new LinkedList<TextField>();
						 								 for (Node n : l) {
						 								 	 if (n instanceof TextField) {
						 								 	 	choosenOperation.add((TextField)n);
						 								 	  }
						 								 }
						 								 
						 								 definition.setText(definitions_map.get(newValue.getValue()));
						 								 precondition.setText(preconditions_map.get(newValue.getValue()));
						 								 postcondition.setText(postconditions_map.get(newValue.getValue()));
						 								 
						 						     }
						 							 else {
						 								 Label l = new Label(newValue.getValue() + " is no contract information in requirement model.");
						 								 l.setPadding(new Insets(8, 8, 8, 8));
						 								 operation_paras.setContent(l);
						 							 }	
						 							 
						 							 //op invariants
						 							 if (vb != null) {
						 							 	ScrollPane scrollPane = new ScrollPane(vb);
						 							 	scrollPane.setFitToWidth(true);
						 							 	invariants_panes.setMaxHeight(200); 
						 							 	//all_invariant_pane.setContent(scrollPane);	
						 							 	
						 							 	invariants_panes.setContent(scrollPane);
						 							 } else {
						 							 	 Label l = new Label(newValue.getValue() + " is no related invariants");
						 							     l.setPadding(new Insets(8, 8, 8, 8));
						 							     invariants_panes.setContent(l);
						 							 }
						 							 
						 							 //reset pre- and post-conditions area color
						 							 precondition.setStyle("-fx-background-color:#FFFFFF; -fx-control-inner-background: #FFFFFF ");
						 							 postcondition.setStyle("-fx-background-color:#FFFFFF; -fx-control-inner-background: #FFFFFF");
						 							 //reset condition panel title
						 							 precondition_pane.setText("Precondition");
						 							 postcondition_pane.setText("Postcondition");
						 						} 
						 				);
		TreeItem<String> treeRootmanager = new TreeItem<String>("Root node");
			TreeItem<String> subTreeRoot_manageAccount = new TreeItem<String>("manageAccount");
			subTreeRoot_manageAccount.getChildren().addAll(Arrays.asList(			 		    
					 	new TreeItem<String>("createAccount")
				 		));	
		
		treeRootmanager.getChildren().addAll(Arrays.asList(
			subTreeRoot_manageAccount
					));
		
		treeRootmanager.setExpanded(true);

		actor_treeview_manager.setShowRoot(false);
		actor_treeview_manager.setRoot(treeRootmanager);
		
		//TreeView click, then open the GridPane for inputing parameters
		actor_treeview_manager.getSelectionModel().selectedItemProperty().addListener(
						 (observable, oldValue, newValue) -> { 
						 								
						 							 //clear the previous return
													 operation_return_pane.setContent(new Label());
													 
						 							 clickedOp = newValue.getValue();
						 							 GridPane op = operationPanels.get(clickedOp);
						 							 VBox vb = opInvariantPanel.get(clickedOp);
						 							 
						 							 //op pannel
						 							 if (op != null) {
						 								 operation_paras.setContent(operationPanels.get(newValue.getValue()));
						 								 
						 								 ObservableList<Node> l = operationPanels.get(newValue.getValue()).getChildren();
						 								 choosenOperation = new LinkedList<TextField>();
						 								 for (Node n : l) {
						 								 	 if (n instanceof TextField) {
						 								 	 	choosenOperation.add((TextField)n);
						 								 	  }
						 								 }
						 								 
						 								 definition.setText(definitions_map.get(newValue.getValue()));
						 								 precondition.setText(preconditions_map.get(newValue.getValue()));
						 								 postcondition.setText(postconditions_map.get(newValue.getValue()));
						 								 
						 						     }
						 							 else {
						 								 Label l = new Label(newValue.getValue() + " is no contract information in requirement model.");
						 								 l.setPadding(new Insets(8, 8, 8, 8));
						 								 operation_paras.setContent(l);
						 							 }	
						 							 
						 							 //op invariants
						 							 if (vb != null) {
						 							 	ScrollPane scrollPane = new ScrollPane(vb);
						 							 	scrollPane.setFitToWidth(true);
						 							 	invariants_panes.setMaxHeight(200); 
						 							 	//all_invariant_pane.setContent(scrollPane);	
						 							 	
						 							 	invariants_panes.setContent(scrollPane);
						 							 } else {
						 							 	 Label l = new Label(newValue.getValue() + " is no related invariants");
						 							     l.setPadding(new Insets(8, 8, 8, 8));
						 							     invariants_panes.setContent(l);
						 							 }
						 							 
						 							 //reset pre- and post-conditions area color
						 							 precondition.setStyle("-fx-background-color:#FFFFFF; -fx-control-inner-background: #FFFFFF ");
						 							 postcondition.setStyle("-fx-background-color:#FFFFFF; -fx-control-inner-background: #FFFFFF");
						 							 //reset condition panel title
						 							 precondition_pane.setText("Precondition");
						 							 postcondition_pane.setText("Postcondition");
						 						} 
						 				);
		TreeItem<String> treeRootstudent = new TreeItem<String>("Root node");
			TreeItem<String> subTreeRoot_joinTeam = new TreeItem<String>("joinTeam");
			subTreeRoot_joinTeam.getChildren().addAll(Arrays.asList(			 		    
					 	new TreeItem<String>("applyJoinTeam"),
					 	new TreeItem<String>("applyJoinGroup"),
					 	new TreeItem<String>("exitGroup"),
					 	new TreeItem<String>("exitTeam")
				 		));	
			TreeItem<String> subTreeRoot_createPlan = new TreeItem<String>("createPlan");
			subTreeRoot_createPlan.getChildren().addAll(Arrays.asList(			 		    
					 	new TreeItem<String>("createPlan"),
					 	new TreeItem<String>("editPlan"),
					 	new TreeItem<String>("finishPlan")
				 		));	
			TreeItem<String> subTreeRoot_createDaily = new TreeItem<String>("createDaily");
			subTreeRoot_createDaily.getChildren().addAll(Arrays.asList(			 		    
					 	new TreeItem<String>("createDaily"),
					 	new TreeItem<String>("editDaily"),
					 	new TreeItem<String>("finishDaily")
				 		));	
		
		treeRootstudent.getChildren().addAll(Arrays.asList(
			subTreeRoot_joinTeam,
			subTreeRoot_createPlan,
			subTreeRoot_createDaily
					));
		treeRootstudent.getChildren().addAll(Arrays.asList(
			new TreeItem<String>("operateAccount")
			));
		
		treeRootstudent.setExpanded(true);

		actor_treeview_student.setShowRoot(false);
		actor_treeview_student.setRoot(treeRootstudent);
		
		//TreeView click, then open the GridPane for inputing parameters
		actor_treeview_student.getSelectionModel().selectedItemProperty().addListener(
						 (observable, oldValue, newValue) -> { 
						 								
						 							 //clear the previous return
													 operation_return_pane.setContent(new Label());
													 
						 							 clickedOp = newValue.getValue();
						 							 GridPane op = operationPanels.get(clickedOp);
						 							 VBox vb = opInvariantPanel.get(clickedOp);
						 							 
						 							 //op pannel
						 							 if (op != null) {
						 								 operation_paras.setContent(operationPanels.get(newValue.getValue()));
						 								 
						 								 ObservableList<Node> l = operationPanels.get(newValue.getValue()).getChildren();
						 								 choosenOperation = new LinkedList<TextField>();
						 								 for (Node n : l) {
						 								 	 if (n instanceof TextField) {
						 								 	 	choosenOperation.add((TextField)n);
						 								 	  }
						 								 }
						 								 
						 								 definition.setText(definitions_map.get(newValue.getValue()));
						 								 precondition.setText(preconditions_map.get(newValue.getValue()));
						 								 postcondition.setText(postconditions_map.get(newValue.getValue()));
						 								 
						 						     }
						 							 else {
						 								 Label l = new Label(newValue.getValue() + " is no contract information in requirement model.");
						 								 l.setPadding(new Insets(8, 8, 8, 8));
						 								 operation_paras.setContent(l);
						 							 }	
						 							 
						 							 //op invariants
						 							 if (vb != null) {
						 							 	ScrollPane scrollPane = new ScrollPane(vb);
						 							 	scrollPane.setFitToWidth(true);
						 							 	invariants_panes.setMaxHeight(200); 
						 							 	//all_invariant_pane.setContent(scrollPane);	
						 							 	
						 							 	invariants_panes.setContent(scrollPane);
						 							 } else {
						 							 	 Label l = new Label(newValue.getValue() + " is no related invariants");
						 							     l.setPadding(new Insets(8, 8, 8, 8));
						 							     invariants_panes.setContent(l);
						 							 }
						 							 
						 							 //reset pre- and post-conditions area color
						 							 precondition.setStyle("-fx-background-color:#FFFFFF; -fx-control-inner-background: #FFFFFF ");
						 							 postcondition.setStyle("-fx-background-color:#FFFFFF; -fx-control-inner-background: #FFFFFF");
						 							 //reset condition panel title
						 							 precondition_pane.setText("Precondition");
						 							 postcondition_pane.setText("Postcondition");
						 						} 
						 				);
		TreeItem<String> treeRootteacher = new TreeItem<String>("Root node");
			TreeItem<String> subTreeRoot_createTeam = new TreeItem<String>("createTeam");
			subTreeRoot_createTeam.getChildren().addAll(Arrays.asList(			 		    
					 	new TreeItem<String>("createTeam"),
					 	new TreeItem<String>("createGroup"),
					 	new TreeItem<String>("handleTeamApply"),
					 	new TreeItem<String>("handleGroupApply"),
					 	new TreeItem<String>("dismissGroup"),
					 	new TreeItem<String>("dismissTeam")
				 		));	
			TreeItem<String> subTreeRoot_checkPlan = new TreeItem<String>("checkPlan");
			subTreeRoot_checkPlan.getChildren().addAll(Arrays.asList(			 		    
				 		));	
			TreeItem<String> subTreeRoot_manageDaily = new TreeItem<String>("manageDaily");
			subTreeRoot_manageDaily.getChildren().addAll(Arrays.asList(			 		    
					 	new TreeItem<String>("operateDaily"),
					 	new TreeItem<String>("deleteDaily")
				 		));	
		
		treeRootteacher.getChildren().addAll(Arrays.asList(
			subTreeRoot_createTeam,
			subTreeRoot_checkPlan,
			subTreeRoot_manageDaily
					));
		treeRootteacher.getChildren().addAll(Arrays.asList(
			new TreeItem<String>("operateAccount")
			));
		
		treeRootteacher.setExpanded(true);

		actor_treeview_teacher.setShowRoot(false);
		actor_treeview_teacher.setRoot(treeRootteacher);
		
		//TreeView click, then open the GridPane for inputing parameters
		actor_treeview_teacher.getSelectionModel().selectedItemProperty().addListener(
						 (observable, oldValue, newValue) -> { 
						 								
						 							 //clear the previous return
													 operation_return_pane.setContent(new Label());
													 
						 							 clickedOp = newValue.getValue();
						 							 GridPane op = operationPanels.get(clickedOp);
						 							 VBox vb = opInvariantPanel.get(clickedOp);
						 							 
						 							 //op pannel
						 							 if (op != null) {
						 								 operation_paras.setContent(operationPanels.get(newValue.getValue()));
						 								 
						 								 ObservableList<Node> l = operationPanels.get(newValue.getValue()).getChildren();
						 								 choosenOperation = new LinkedList<TextField>();
						 								 for (Node n : l) {
						 								 	 if (n instanceof TextField) {
						 								 	 	choosenOperation.add((TextField)n);
						 								 	  }
						 								 }
						 								 
						 								 definition.setText(definitions_map.get(newValue.getValue()));
						 								 precondition.setText(preconditions_map.get(newValue.getValue()));
						 								 postcondition.setText(postconditions_map.get(newValue.getValue()));
						 								 
						 						     }
						 							 else {
						 								 Label l = new Label(newValue.getValue() + " is no contract information in requirement model.");
						 								 l.setPadding(new Insets(8, 8, 8, 8));
						 								 operation_paras.setContent(l);
						 							 }	
						 							 
						 							 //op invariants
						 							 if (vb != null) {
						 							 	ScrollPane scrollPane = new ScrollPane(vb);
						 							 	scrollPane.setFitToWidth(true);
						 							 	invariants_panes.setMaxHeight(200); 
						 							 	//all_invariant_pane.setContent(scrollPane);	
						 							 	
						 							 	invariants_panes.setContent(scrollPane);
						 							 } else {
						 							 	 Label l = new Label(newValue.getValue() + " is no related invariants");
						 							     l.setPadding(new Insets(8, 8, 8, 8));
						 							     invariants_panes.setContent(l);
						 							 }
						 							 
						 							 //reset pre- and post-conditions area color
						 							 precondition.setStyle("-fx-background-color:#FFFFFF; -fx-control-inner-background: #FFFFFF ");
						 							 postcondition.setStyle("-fx-background-color:#FFFFFF; -fx-control-inner-background: #FFFFFF");
						 							 //reset condition panel title
						 							 precondition_pane.setText("Precondition");
						 							 postcondition_pane.setText("Postcondition");
						 						} 
						 				);
	}

	/**
	*    Execute Operation
	*/
	@FXML
	public void execute(ActionEvent event) {
		
		switch (clickedOp) {
		case "createAccount" : createAccount(); break;
		case "createTeam" : createTeam(); break;
		case "createGroup" : createGroup(); break;
		case "handleTeamApply" : handleTeamApply(); break;
		case "handleGroupApply" : handleGroupApply(); break;
		case "dismissGroup" : dismissGroup(); break;
		case "dismissTeam" : dismissTeam(); break;
		case "applyJoinTeam" : applyJoinTeam(); break;
		case "applyJoinGroup" : applyJoinGroup(); break;
		case "exitGroup" : exitGroup(); break;
		case "exitTeam" : exitTeam(); break;
		case "createPlan" : createPlan(); break;
		case "editPlan" : editPlan(); break;
		case "finishPlan" : finishPlan(); break;
		case "createDaily" : createDaily(); break;
		case "editDaily" : editDaily(); break;
		case "finishDaily" : finishDaily(); break;
		case "deleteDaily" : deleteDaily(); break;
		case "operateDaily" : operateDaily(); break;
		
		}
		
		System.out.println("execute buttion clicked");
		
		//checking relevant invariants
		opInvairantPanelUpdate();
	}

	/**
	*    Refresh All
	*/		
	@FXML
	public void refresh(ActionEvent event) {
		
		refreshAll();
		System.out.println("refresh all");
	}		
	
	/**
	*    Save All
	*/			
	@FXML
	public void save(ActionEvent event) {
		
		Stage stage = (Stage) mainPane.getScene().getWindow();
		
		FileChooser fileChooser = new FileChooser();
		fileChooser.setTitle("Save State to File");
		fileChooser.setInitialFileName("*.state");
		fileChooser.getExtensionFilters().addAll(
		         new ExtensionFilter("RMCode State File", "*.state"));
		
		File file = fileChooser.showSaveDialog(stage);
		
		if (file != null) {
			System.out.println("save state to file " + file.getAbsolutePath());				
			EntityManager.save(file);
		}
	}
	
	/**
	*    Load All
	*/			
	@FXML
	public void load(ActionEvent event) {
		
		Stage stage = (Stage) mainPane.getScene().getWindow();
		
		FileChooser fileChooser = new FileChooser();
		fileChooser.setTitle("Open State File");
		fileChooser.getExtensionFilters().addAll(
		         new ExtensionFilter("RMCode State File", "*.state"));
		
		File file = fileChooser.showOpenDialog(stage);
		
		if (file != null) {
			System.out.println("choose file" + file.getAbsolutePath());
			EntityManager.load(file); 
		}
		
		//refresh GUI after load data
		refreshAll();
	}
	
	
	//precondition unsat dialog
	public void preconditionUnSat() {
		
		Alert alert = new Alert(AlertType.WARNING, "");
        alert.initModality(Modality.APPLICATION_MODAL);
        alert.initOwner(mainPane.getScene().getWindow());
        alert.getDialogPane().setContentText("Precondtion is not satisfied");
        alert.getDialogPane().setHeaderText(null);
        alert.showAndWait();	
	}
	
	//postcondition unsat dialog
	public void postconditionUnSat() {
		
		Alert alert = new Alert(AlertType.WARNING, "");
        alert.initModality(Modality.APPLICATION_MODAL);
        alert.initOwner(mainPane.getScene().getWindow());
        alert.getDialogPane().setContentText("Postcondtion is not satisfied");
        alert.getDialogPane().setHeaderText(null);
        alert.showAndWait();	
	}

	public void thirdpartyServiceUnSat() {
		
		Alert alert = new Alert(AlertType.WARNING, "");
        alert.initModality(Modality.APPLICATION_MODAL);
        alert.initOwner(mainPane.getScene().getWindow());
        alert.getDialogPane().setContentText("third party service is exception");
        alert.getDialogPane().setHeaderText(null);
        alert.showAndWait();	
	}		
	
	
	public void createAccount() {
		
		System.out.println("execute createAccount");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: createAccount in service: ManageAccountService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(manageaccountservice_service.createAccount(
			createAccount_id_t.getText(),
			createAccount_username_t.getText(),
			IdentityType.valueOf(createAccount_identity_cb.getSelectionModel().getSelectedItem().toString()),
			createAccount_password_t.getText()
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}
	public void createTeam() {
		
		System.out.println("execute createTeam");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: createTeam in service: CreateTeamService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(createteamservice_service.createTeam(
			createTeam_id_t.getText(),
			createTeam_userId_t.getText(),
			createTeam_name_t.getText(),
			createTeam_message_t.getText()
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}
	public void createGroup() {
		
		System.out.println("execute createGroup");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: createGroup in service: CreateTeamService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(createteamservice_service.createGroup(
			createGroup_id_t.getText(),
			createGroup_teamId_t.getText(),
			createGroup_name_t.getText(),
			createGroup_message_t.getText()
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}
	public void handleTeamApply() {
		
		System.out.println("execute handleTeamApply");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: handleTeamApply in service: CreateTeamService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(createteamservice_service.handleTeamApply(
			handleTeamApply_teamId_t.getText(),
			Boolean.valueOf(handleTeamApply_agree_t.getText())
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}
	public void handleGroupApply() {
		
		System.out.println("execute handleGroupApply");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: handleGroupApply in service: CreateTeamService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(createteamservice_service.handleGroupApply(
			handleGroupApply_groupId_t.getText(),
			Boolean.valueOf(handleGroupApply_agree_t.getText())
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}
	public void dismissGroup() {
		
		System.out.println("execute dismissGroup");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: dismissGroup in service: CreateTeamService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(createteamservice_service.dismissGroup(
			dismissGroup_groupId_t.getText()
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}
	public void dismissTeam() {
		
		System.out.println("execute dismissTeam");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: dismissTeam in service: CreateTeamService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(createteamservice_service.dismissTeam(
			dismissTeam_teamId_t.getText()
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}
	public void applyJoinTeam() {
		
		System.out.println("execute applyJoinTeam");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: applyJoinTeam in service: JoinTeamService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(jointeamservice_service.applyJoinTeam(
			applyJoinTeam_teamId_t.getText(),
			applyJoinTeam_studentId_t.getText()
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}
	public void applyJoinGroup() {
		
		System.out.println("execute applyJoinGroup");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: applyJoinGroup in service: JoinTeamService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(jointeamservice_service.applyJoinGroup(
			applyJoinGroup_groupId_t.getText(),
			applyJoinGroup_studentId_t.getText()
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}
	public void exitGroup() {
		
		System.out.println("execute exitGroup");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: exitGroup in service: JoinTeamService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(jointeamservice_service.exitGroup(
			exitGroup_groupId_t.getText(),
			exitGroup_studentId_t.getText()
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}
	public void exitTeam() {
		
		System.out.println("execute exitTeam");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: exitTeam in service: JoinTeamService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(jointeamservice_service.exitTeam(
			exitTeam_teamId_t.getText(),
			exitTeam_studentId_t.getText()
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}
	public void createPlan() {
		
		System.out.println("execute createPlan");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: createPlan in service: CreatePlanService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(createplanservice_service.createPlan(
			createPlan_groupId_t.getText(),
			createPlan_id_t.getText(),
			createPlan_studentId_t.getText(),
			createPlan_content_t.getText(),
			Boolean.valueOf(createPlan_finish_t.getText())
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}
	public void editPlan() {
		
		System.out.println("execute editPlan");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: editPlan in service: CreatePlanService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(createplanservice_service.editPlan(
			editPlan_id_t.getText(),
			editPlan_content_t.getText()
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}
	public void finishPlan() {
		
		System.out.println("execute finishPlan");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: finishPlan in service: CreatePlanService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(createplanservice_service.finishPlan(
			finishPlan_id_t.getText(),
			Boolean.valueOf(finishPlan_finish_t.getText())
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}
	public void createDaily() {
		
		System.out.println("execute createDaily");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: createDaily in service: CreateDailyService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(createdailyservice_service.createDaily(
			createDaily_id_t.getText(),
			AffairType.valueOf(createDaily_type_cb.getSelectionModel().getSelectedItem().toString()),
			createDaily_groupId_t.getText(),
			createDaily_studentId_t.getText(),
			createDaily_content_t.getText()
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}
	public void editDaily() {
		
		System.out.println("execute editDaily");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: editDaily in service: CreateDailyService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(createdailyservice_service.editDaily(
			editDaily_id_t.getText(),
			AffairType.valueOf(editDaily_type_cb.getSelectionModel().getSelectedItem().toString()),
			editDaily_content_t.getText()
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}
	public void finishDaily() {
		
		System.out.println("execute finishDaily");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: finishDaily in service: CreateDailyService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(createdailyservice_service.finishDaily(
			finishDaily_id_t.getText()
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}
	public void deleteDaily() {
		
		System.out.println("execute deleteDaily");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: deleteDaily in service: ManageDailyService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(managedailyservice_service.deleteDaily(
			deleteDaily_id_t.getText()
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}
	public void operateDaily() {
		
		System.out.println("execute operateDaily");
		String time = String.format("%1$tH:%1$tM:%1$tS", System.currentTimeMillis());
		log.appendText(time + " -- execute operation: operateDaily in service: ManageDailyService ");
		
		try {
			//invoke op with parameters
			//return value is primitive type, bind result to label.
			String result = String.valueOf(managedailyservice_service.operateDaily(
			operateDaily_id_t.getText(),
			Boolean.valueOf(operateDaily_agree_t.getText())
			));	
			Label l = new Label(result);
			l.setPadding(new Insets(8, 8, 8, 8));
			operation_return_pane.setContent(l);
		    log.appendText(" -- success!\n");
		    //set pre- and post-conditions text area color
		    precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #7CFC00");
		    //contract evaluation result
		    precondition_pane.setText("Precondition: True");
		    postcondition_pane.setText("Postcondition: True");
		    
		    
		} catch (PreconditionException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (PostconditionException e) {
			log.appendText(" -- failed!\n");
			postcondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");	
			postcondition_pane.setText("Postcondition: False");
			postconditionUnSat();
			
		} catch (NumberFormatException e) {
			log.appendText(" -- failed!\n");
			precondition.setStyle("-fx-background-color:#000000; -fx-control-inner-background: #FF0000");
			precondition_pane.setText("Precondition: False");	
			preconditionUnSat();
			
		} catch (Exception e ) {		
			if (e instanceof ThirdPartyServiceException)
				thirdpartyServiceUnSat();
		}
	}




	//select object index
	int objectindex;
	
	@FXML
	TabPane mainPane;

	@FXML
	TextArea log;
	
	@FXML
	TreeView<String> actor_treeview_comuser;
	@FXML
	TreeView<String> actor_treeview_manager;
	@FXML
	TreeView<String> actor_treeview_student;
	@FXML
	TreeView<String> actor_treeview_teacher;
	
	@FXML
	TreeView<String> actor_treeview_administrator;


	@FXML
	TextArea definition;
	@FXML
	TextArea precondition;
	@FXML
	TextArea postcondition;
	@FXML
	TextArea invariants;
	
	@FXML
	TitledPane precondition_pane;
	@FXML
	TitledPane postcondition_pane;
	
	//chosen operation textfields
	List<TextField> choosenOperation;
	String clickedOp;
		
	@FXML
	TableView<ClassInfo> class_statisic;
	@FXML
	TableView<AssociationInfo> association_statisic;
	
	Map<String, ObservableList<AssociationInfo>> allassociationData;
	ObservableList<ClassInfo> classInfodata;
	
	LabManageSystem labmanagesystem_service;
	ThirdPartyServices thirdpartyservices_service;
	CreateTeamService createteamservice_service;
	JoinTeamService jointeamservice_service;
	CreatePlanService createplanservice_service;
	CreateDailyService createdailyservice_service;
	CheckPlanService checkplanservice_service;
	ManageDailyService managedailyservice_service;
	ManageAccountService manageaccountservice_service;
	
	ClassInfo user;
	ClassInfo student;
	ClassInfo teacher;
	ClassInfo manager;
	ClassInfo team;
	ClassInfo group;
	ClassInfo daily;
	ClassInfo plan;
	ClassInfo apply;
	ClassInfo studentinteam;
	ClassInfo studentingroup;
		
	@FXML
	TitledPane object_statics;
	Map<String, TableView> allObjectTables;
	
	@FXML
	TitledPane operation_paras;
	
	@FXML
	TitledPane operation_return_pane;
	
	@FXML 
	TitledPane all_invariant_pane;
	
	@FXML
	TitledPane invariants_panes;
	
	Map<String, GridPane> operationPanels;
	Map<String, VBox> opInvariantPanel;
	
	//all textfiled or eumntity
	TextField createAccount_id_t;
	TextField createAccount_username_t;
	ChoiceBox createAccount_identity_cb;
	TextField createAccount_password_t;
	TextField createTeam_id_t;
	TextField createTeam_userId_t;
	TextField createTeam_name_t;
	TextField createTeam_message_t;
	TextField createGroup_id_t;
	TextField createGroup_teamId_t;
	TextField createGroup_name_t;
	TextField createGroup_message_t;
	TextField handleTeamApply_teamId_t;
	TextField handleTeamApply_agree_t;
	TextField handleGroupApply_groupId_t;
	TextField handleGroupApply_agree_t;
	TextField dismissGroup_groupId_t;
	TextField dismissTeam_teamId_t;
	TextField applyJoinTeam_teamId_t;
	TextField applyJoinTeam_studentId_t;
	TextField applyJoinGroup_groupId_t;
	TextField applyJoinGroup_studentId_t;
	TextField exitGroup_groupId_t;
	TextField exitGroup_studentId_t;
	TextField exitTeam_teamId_t;
	TextField exitTeam_studentId_t;
	TextField createPlan_groupId_t;
	TextField createPlan_id_t;
	TextField createPlan_studentId_t;
	TextField createPlan_content_t;
	TextField createPlan_finish_t;
	TextField editPlan_id_t;
	TextField editPlan_content_t;
	TextField finishPlan_id_t;
	TextField finishPlan_finish_t;
	TextField createDaily_id_t;
	ChoiceBox createDaily_type_cb;
	TextField createDaily_groupId_t;
	TextField createDaily_studentId_t;
	TextField createDaily_content_t;
	TextField editDaily_id_t;
	ChoiceBox editDaily_type_cb;
	TextField editDaily_content_t;
	TextField finishDaily_id_t;
	TextField deleteDaily_id_t;
	TextField operateDaily_id_t;
	TextField operateDaily_agree_t;
	
	HashMap<String, String> definitions_map;
	HashMap<String, String> preconditions_map;
	HashMap<String, String> postconditions_map;
	HashMap<String, String> invariants_map;
	LinkedHashMap<String, String> service_invariants_map;
	LinkedHashMap<String, String> entity_invariants_map;
	LinkedHashMap<String, Label> service_invariants_label_map;
	LinkedHashMap<String, Label> entity_invariants_label_map;
	LinkedHashMap<String, Label> op_entity_invariants_label_map;
	LinkedHashMap<String, Label> op_service_invariants_label_map;
	

	
}
